Kubernetes Pod Debugging Cheat Sheet/Copy a pod and override its command

Use kubectl debug to clone a pod with a safer command for inspection.

Section: Init Container Debugging

Copy a pod and override its command

bash
bash
kubectl debug <pod> -n <namespace> --copy-to=<pod>-copy --set-image='*=busybox:1.36' -it

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Init Container Debugging
Inspect init container statuses
See waiting, terminated, and exit details for init containers.
OpenIn sheetbashsame section
Read logs from an init container
Inspect the failing setup step before app containers start.
OpenIn sheetbashsame section
Describe init container failure
Read events and termination details from the pod description.
OpenIn sheetbashsame section
List Pending pods
Find pods stuck before startup.
Find CrashLoopBackOff pods
List pods that are restarting and failing to stay up.
Inspect configured probes
View readiness, liveness, and startup probe definitions.