Debugging an Image Without a Shell
The app's image is distroless: kubectl exec ... -- sh fails because there is no shell. How can you get a shell next to the running process without rebuilding the image?
kubectl exec ... -- sh
Choose one answer
Recreate the Pod with privileged: true, which mounts the node's shell
privileged: true
kubectl debug -it <pod> --image=busybox --target=<container>
Copy a static /bin/sh into the container with kubectl cp, then exec it
/bin/sh
kubectl cp
kubectl attach -it <pod> --shell=/bin/sh, which injects a shell binary
kubectl attach -it <pod> --shell=/bin/sh