Senior
How to exit the kubectl exec command (interactive session in a Kubernetes pod)?
sobes.tech AI
Answer from AI
To exit an interactive session started with kubectl exec -it <pod> -- /bin/bash or a similar command, you should:
-
Press the key combination
Ctrl + PthenCtrl + Q. This will detach you from the session, leaving the process inside the pod running. -
If you want to completely end the session and the process inside, you can simply type
exitorCtrl + Dinside the interactive shell.
Thus, Ctrl+P Ctrl+Q is a safe way to exit the session without killing the process inside the container.