Home > OS >  Can you avoid the pod to be restarted after kubectl attach?
Can you avoid the pod to be restarted after kubectl attach?

Time:02-11

I have an ubuntu image that I use for debugging. I do kubectl attach my-app -c my-app -it and then many apt-get install and other configurations I need.

The problem is when I exit ctrl c the pod seems to get restarted and I loose all what I did
Is there a way like --restart=never to avoid the container to be recreated

CodePudding user response:

Run another shell session kubectl exec my-app -c my-app -it -- bash to prepare your container. Alternately, if your pod spec has the following set to true:

stdin: true 
tty: true 

You use the escape sequence Ctrl P followed by Ctrl Q to detach from the container after kubectl attach -it to the container.

  • Related