69

I have problem login into one container of a multi-container pod. I get the container id from the kubectl describe pod <pod-name>

kubectl describe pod ipengine-net-benchmark-488656591-gjrpc -c <container id> 

When i try:

kubectl exec -ti ipengine-net-benchmark-488656591-gjrpc -c 70761432854f /bin/bash

It says: Error from server: container 70761432854f is not valid for pod ipengine-net-benchmark-488656591-gjrpc

1 Answer 1

120

Ah once more detailed reading the man page of kubectl exec :

Flags:

  -c, --container="": Container name. If omitted, the first container in the pod will be chosen
  -p, --pod="": Pod name
  -i, --stdin[=false]: Pass stdin to the container
  -t, --tty[=false]: Stdin is a TTY

So i just used the container name from my manifest.yaml and it worked like charm.

Name of the container: ipengine-net-benchmark-iperf-server

kubectl exec -ti ipengine-net-benchmark-488656591-gjrpc -c ipengine-net-benchmark-iperf-server /bin/bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.