WebDeveloper2017
WebDeveloper2017

Reputation: 83

Keep container up in the pod - kubenetes

One of the container in the pod is going down. To debug, i have to be able to login to the container which is going down.

In docker, we had an option to use below

docker run -d sleep infinity

But what about kubenetes? The container is one of the 3 containers in the POD. How can i bring it up and use sleep infinity or anything similar.

Thank you in advance

Upvotes: 0

Views: 309

Answers (1)

The Fool
The Fool

Reputation: 20547

You can do the same. Make the command of the container sleep infinity and then exec into it.

You can do the same in serval ways.

  1. Edit the yaml manifest and apply.
  2. Use kubectl edit <deployment-name> on the deployment resource in your cluster.
  3. Use kubectl patch on the deployment resource in your cluster.

You can exec into the specifc container by using the --container or short -c flag.

kubectl exec <pod> --container <container> -ti -- sh

Upvotes: 1

Related Questions