When using Kubernetes, sooner or later you’ll have a Pod that doesn’t work as expected. Last friday I blogged about what to do when your Pod is in a crash loop.
Today I’ll share a trick to open a shell on a Pod in trouble.
To open a Bash shell on a failing pod you can execute the following command:
kubectl exec –it <pod name> – bash
This will open a Bash shell on the specified pod:
PS /home/bart> kubectl exec -it example-pod-86f495c7f7-7s87g -- bash
root@example-pod-86f495c7f7-7s87g:/app#