kubectl exec -it web-7d8f9c -- /bin/sh

Category: Kubernetes & Containers

kubectl exec -it web-7d8f9c -- /bin/sh

Open a shell inside a pod

Runs /bin/sh interactively inside the running pod, giving you a shell for troubleshooting. The double dash separates kubectl flags from the command to run in the container. Changes you make inside are lost when the pod is recreated.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.