Interview Prep/DevSecOps/Kubernetes Security

Developers want to debug distroless pods that have no shell. How do you allow that securely?

BeginnerScenarioKubernetes Security
Answer

Situation read → Adding a shell back to images undoes the hardening. Ephemeral containers give a debug shell only when needed.

What I'd do →

  1. Use kubectl debug -it orders-7d9f --image=busybox:1.36 --target=app to attach a temporary container sharing the process namespace.
  2. Allow pods/ephemeralcontainers only in non-prod by default; prod via JIT access.
  3. Log and alert on ephemeral container creation in prod via audit logs.
  4. Keep debug images in the approved registry.

Why → Images stay minimal, and debugging is controlled and audited.

Interview tip → kubectl debug is the modern answer to "but I need a shell".

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Kubernetes Security