File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ # kubectl debug
2+
3+ > Debug cluster resources using interactive debugging containers.
4+ > More information: < https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug > .
5+
6+ - Create an interactive debugging session in a pod and immediately attach to it:
7+
8+ ` kubectl debug {{pod_name}} {{[-it|--stdin --tty]}} --image busybox `
9+
10+ - Create a debug container with a custom image and name:
11+
12+ ` kubectl debug --image {{image}} {{[-c|--container]}} {{container_name}} {{pod_name}} `
13+
14+ - 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 ` ):
15+
16+ ` kubectl debug node/{{node_name}} {{[-it|--stdin --tty]}} --image busybox `
17+
18+ - Create a copy of a pod and add a debug container to it:
19+
20+ ` kubectl debug {{pod_name}} {{[-it|--stdin --tty]}} --image {{image}} --copy-to {{pod_copy_name}} `
21+
22+ - Create a copy of a pod and change the command of a specific container:
23+
24+ ` kubectl debug {{pod_name}} {{[-it|--stdin --tty]}} --copy-to {{pod_copy_name}} --container {{container_name}} -- {{command}} `
25+
26+ - Create a copy of a pod and change the image of a specific container:
27+
28+ ` kubectl debug {{pod_name}} --copy-to {{pod_copy_name}} --set-image {{container_name}}={{image}} `
29+
30+ - Create a copy of a pod and change all container images:
31+
32+ ` kubectl debug {{pod_name}} --copy-to {{pod_copy_name}} --set-image '*={{image}}' `
33+
34+ - Create an ephemeral debug container and target a specific container (useful for debugging distroless containers):
35+
36+ ` kubectl debug {{pod_name}} {{[-it|--stdin --tty]}} --image {{image}} --target {{target_container_name}} `
You can’t perform that action at this time.
0 commit comments