OnCallReady

Commands

kubectl debug - Create debugging sessions for troubleshooting workloads and nodes

kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]

Options you will use

--image=
Container image to use for debug container.
--target=
When using an ephemeral container, target processes in this container name.
-i, --stdin
Keep stdin open on the container(s) in the pod, even if nothing is attached.
-t, --tty
Allocate a TTY for the debugging container.
--profile=legacy
Options are "legacy", "general", "baseline", "netadmin", "restricted" or "sysadmin".

Examples

$ kubectl debug -it pod/api-7c9 --image=nicolaka/netshoot --target=api

an ephemeral container in the pod's network namespace: curl localhost, dig, ss

$ kubectl debug node/worker-1 -it --image=busybox:1.36

a pod on the node with the host network and / mounted at /host; chroot /host to use the node's own tools

$ kubectl delete pod node-debugger-worker-1-xxxxx

node debug pods are not cleaned up for you

Gotchas

Try kubectl debug in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.