Interview Prep/Kubernetes/Pod startup failures

`kubectl exec -it web-x -- sh` fails with `OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH`.

BeginnerTroubleshootingPod startup failures
Answer

Likely causes → Distroless or scratch image: there is no shell to exec into. This is by design.

Diagnose →

kubectl get pod web-x -o jsonpath='{.spec.containers[0].image}'

Fix → Use an ephemeral debug container that shares the process namespace:

kubectl debug -it web-x --image=nicolaka/netshoot --target=app
# Then look at the app filesystem through /proc
ls /proc/1/root/app

Prevent → Keep distroless in production and give the team a known debug image and RBAC for pods/ephemeralcontainers.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures