CmdID

CmdID / Commands

kubectl-debug

Debug cluster resources using interactive debugging containers. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Create an interactive debugging session in a pod and immediately attach to it

kubectl debug pod_name --stdin --tty --image busyboxIdentify
--stdinKeep stdin open on the container(s) in the pod, even if nothing is attached. kubectl reference
--ttyAllocate a TTY for the debugging container. kubectl reference
--imageContainer image to use for debug container. kubectl reference

Create a debug container with a custom image and name

kubectl debug --image image --container container_name pod_nameIdentify
--imageContainer image to use for debug container. kubectl reference
--containerContainer name to use for debug container. kubectl reference

Create an interactive debugging session on a node and immediately attach to it (the container will run in the host namespaces and the host's filesystem will be mounted at /host)

kubectl debug node/node_name --stdin --tty --image busyboxIdentify
--stdinKeep stdin open on the container(s) in the pod, even if nothing is attached. kubectl reference
--ttyAllocate a TTY for the debugging container. kubectl reference
--imageContainer image to use for debug container. kubectl reference

Create a copy of a pod and add a debug container to it

kubectl debug pod_name --stdin --tty --image image --copy-to pod_copy_nameIdentify
--stdinKeep stdin open on the container(s) in the pod, even if nothing is attached. kubectl reference
--ttyAllocate a TTY for the debugging container. kubectl reference
--imageContainer image to use for debug container. kubectl reference
--copy-toCreate a copy of the target Pod with this name. kubectl reference

Create a copy of a pod and change the command of a specific container

kubectl debug pod_name --stdin --tty --copy-to pod_copy_name --container container_name -- commandIdentify
--stdinKeep stdin open on the container(s) in the pod, even if nothing is attached. kubectl reference
--ttyAllocate a TTY for the debugging container. kubectl reference
--copy-toCreate a copy of the target Pod with this name. kubectl reference
--containerContainer name to use for debug container. kubectl reference

Create a copy of a pod and change the image of a specific container

kubectl debug pod_name --copy-to pod_copy_name --set-image container_name=imageIdentify
--copy-toCreate a copy of the target Pod with this name. kubectl reference
--set-imageWhen used with '--copy-to', a list of name=image pairs for changing container images, similar to how 'kubectl set image' works. kubectl reference

Create a copy of a pod and change all container images

kubectl debug pod_name --copy-to pod_copy_name --set-image '*=image'Identify
--copy-toCreate a copy of the target Pod with this name. kubectl reference
--set-imageWhen used with '--copy-to', a list of name=image pairs for changing container images, similar to how 'kubectl set image' works. kubectl reference

Create an ephemeral debug container and target a specific container (useful for debugging distroless containers)

kubectl debug pod_name --stdin --tty --image image --target target_container_nameIdentify
--stdinKeep stdin open on the container(s) in the pod, even if nothing is attached. kubectl reference
--ttyAllocate a TTY for the debugging container. kubectl reference
--imageContainer image to use for debug container. kubectl reference
--targetWhen using an ephemeral container, target processes in this container name. kubectl reference