This is a Bug Report
Problem:
this command doesn't work when trying to access a pod
kubectl exec -it shell-demo -- /bin/bash
usually now i do
kubectl exec -it shell-demo -- sh
Page to Update:
https://kubernetes.io/...
Hi @vmwarelab.
I think that doesn't work because you are using a image that doesn't have the bash command.
for exemple:
The busybox image doesn't have a /bin/bash file
apiVersion: v1
kind: Pod
metadata:
name: busybox-shell-demo
labels:
app: myapp
spec:
containers:
- name: busybox-shell-demo
image: busybox
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
and will fail if we try to use /bin/bash ...
vinicius@ideapad-s145:~$ kubectl exec -it busybox-shell-demo -- /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126
So if we use an image that contains the /bin/bash file, e.x: ubuntu, it will work as expected.
apiVersion: v1
kind: Pod
metadata:
name: ubuntu-shell-demo
labels:
app: myapp
spec:
containers:
- name: ubuntu-shell-demo
image: ubuntu
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
vinicius@ideapad-s145:~$ kubectl exec -it ubuntu-shell-demo -- /bin/bash
root@ubuntu-shell-demo:/#
Hope this helps :)
Thank you very much . Any idea why - - sh works or what - - sh means
Maher AlAsfar
Staff SE – Cloud Management Specialist
Central and Eastern Canada
Solutions Engineering & Technology
Tel : 1 (416) 727-2077 | Email : [email protected] |Blog : vmwarelab.org
From: Vinicius Barbosa notifications@github.com
Sent: Saturday, May 2, 2020 9:04:52 AM
To: kubernetes/website website@noreply.github.com
Cc: Maher AlAsfar malasfar@vmware.com; Mention mention@noreply.github.com
Subject: Re: [kubernetes/website] Issue with k8s.io/docs/tasks/debug-application-cluster/get-shell-running-container/ (#20688)
I think that doesn't work because you are using a image that doesn't have the bash command.
for exemple:
The busybox image doesn't have a /bin/bash file
apiVersion: v1
kind: Pod
metadata:
name: busybox-shell-demo
labels:
app: myapp
spec:
containers:
and will fail if we try to use /bin/bash ...
vinicius@ideapad-s145:~$ kubectl exec -it busybox-shell-demo -- /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: "/bin/bash": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126
So if we use an image that contains the /bin/bash file, e.x: ubuntu, it will work as expected.
apiVersion: v1
kind: Pod
metadata:
name: ubuntu-shell-demo
labels:
app: myapp
spec:
containers:
vinicius@ideapad-s145:~$ kubectl exec -it ubuntu-shell-demo -- /bin/bash
root@ubuntu-shell-demo:/#
Hope this helps :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes%2Fwebsite%2Fissues%2F20688%23issuecomment-622950685&data=02%7C01%7Cmalasfar%40vmware.com%7Cc70d7bbcb9114ad0b06f08d7ee9967b2%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240214950573905&sdata=DdWGfj5S5XYexSXHGDdTnWNL%2F2ejf6mgFlA90Cqojd4%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEXMR6XDAEQMQU7FX5DV6B3RPQK7JANCNFSM4MVX4A4A&data=02%7C01%7Cmalasfar%40vmware.com%7Cc70d7bbcb9114ad0b06f08d7ee9967b2%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240214950573905&sdata=LADZqK5adlMtpsMwvClMA5zjfjsWlLgO1g4LnvHMr8s%3D&reserved=0.
sh is the standard command language interpreter in Unix-like operating systems. Therefore, most (or all) of linux-based images have the sh interpreter.
Thank you very much appreciate the help
Maher AlAsfar
Staff SE – Cloud Management Specialist
Central and Eastern Canada
Solutions Engineering & Technology
Tel : 1 (416) 727-2077 | Email : [email protected] |Blog : vmwarelab.org
From: Vinicius Barbosa notifications@github.com
Sent: Saturday, May 2, 2020 9:18:04 AM
To: kubernetes/website website@noreply.github.com
Cc: Maher AlAsfar malasfar@vmware.com; Mention mention@noreply.github.com
Subject: Re: [kubernetes/website] Issue with k8s.io/docs/tasks/debug-application-cluster/get-shell-running-container/ (#20688)
sh is the standard command language interpreter in Unix-like operating systems. Therefore, most (or all) of linux-based images have the sh interpreter.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes%2Fwebsite%2Fissues%2F20688%23issuecomment-622952401&data=02%7C01%7Cmalasfar%40vmware.com%7Ccff7258dc3b44afc9ef708d7ee9b401e%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240222876236280&sdata=Xu%2BxwL2ZJ7m49JWjVodknTkWt%2FR3MdqPbbhz%2B72VPeQ%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEXMR6W3GXSZKRGQF2HZUUTRPQMQZANCNFSM4MVX4A4A&data=02%7C01%7Cmalasfar%40vmware.com%7Ccff7258dc3b44afc9ef708d7ee9b401e%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240222876236280&sdata=eckvqNlUtg7bdOqAkvWMhgoWLlAnFVwZLI5%2BQjkoOwU%3D&reserved=0.
/close
Done.
@tengqm: Closing this issue.
In response to this:
/close
Done.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Most helpful comment
Thank you very much appreciate the help
Maher AlAsfar
Staff SE – Cloud Management Specialist
Central and Eastern Canada
Solutions Engineering & Technology
Tel : 1 (416) 727-2077 | Email : [email protected] |Blog : vmwarelab.org
From: Vinicius Barbosa notifications@github.com
Sent: Saturday, May 2, 2020 9:18:04 AM
To: kubernetes/website website@noreply.github.com
Cc: Maher AlAsfar malasfar@vmware.com; Mention mention@noreply.github.com
Subject: Re: [kubernetes/website] Issue with k8s.io/docs/tasks/debug-application-cluster/get-shell-running-container/ (#20688)
sh is the standard command language interpreter in Unix-like operating systems. Therefore, most (or all) of linux-based images have the sh interpreter.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes%2Fwebsite%2Fissues%2F20688%23issuecomment-622952401&data=02%7C01%7Cmalasfar%40vmware.com%7Ccff7258dc3b44afc9ef708d7ee9b401e%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240222876236280&sdata=Xu%2BxwL2ZJ7m49JWjVodknTkWt%2FR3MdqPbbhz%2B72VPeQ%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEXMR6W3GXSZKRGQF2HZUUTRPQMQZANCNFSM4MVX4A4A&data=02%7C01%7Cmalasfar%40vmware.com%7Ccff7258dc3b44afc9ef708d7ee9b401e%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637240222876236280&sdata=eckvqNlUtg7bdOqAkvWMhgoWLlAnFVwZLI5%2BQjkoOwU%3D&reserved=0.