It's 3 a.m. The pod is crash-looping. You run kubectl exec -it my-app -- sh and get back OCI runtime exec failed: exec: "sh": executable file not found in $PATH . You try curl localhost:8080/health , and the container just stares back at you. Welcome to distroless.
If you read the last article and switched your images to distroless, you probably felt pretty smug about it. Smaller image, fewer CVEs, no package manager for attackers to play with. Then the first production incident arrived, and you realized your debugging toolbox was also smaller. Congratulations, you traded convenience for security, and now you have to be cleverer about getting into the box.
The good news is that you rarely need to get inside the container. You need to get into its namespaces, and Kubernetes gives you a few ways to do that.
1. The Right Tool: kubectl debug with an Ephemeral Container
An ephemeral container is a temporary container you attach to a running pod.…