1KUBERNETES(1)(kubernetes)                            KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7

NAME

9       kubectl debug - Create debugging sessions for troubleshooting workloads
10       and nodes
11
12
13

SYNOPSIS

15       kubectl debug [OPTIONS]
16
17
18

DESCRIPTION

20       Debug cluster resources using interactive debugging containers.
21
22
23       'debug' provides automation for common debugging tasks for cluster  ob‐
24       jects  identified by resource and name. Pods will be used by default if
25       no resource is specified.
26
27
28       The action taken by 'debug' varies depending on what resource is speci‐
29       fied. Supported actions include:
30
31
32              • Workload:  Create  a  copy of an existing pod with certain at‐
33                tributes changed, for example changing the image tag to a  new
34                version.
35
36              • Workload:  Add  an  ephemeral  container to an already running
37                pod, for example to add debugging utilities without restarting
38                the pod.
39
40              • Node: Create a new pod that runs in the node's host namespaces
41                and can access the node's filesystem.
42
43
44
45

OPTIONS

47       --arguments-only=false      If specified, everything after --  will  be
48       passed to the new container as Args instead of Command.
49
50
51       --attach=false       If  true, wait for the container to start running,
52       and then attach as if 'kubectl attach ...' were called.  Default false,
53       unless '-i/--stdin' is set, in which case the default is true.
54
55
56       -c, --container=""      Container name to use for debug container.
57
58
59       --copy-to=""      Create a copy of the target Pod with this name.
60
61
62       --env=[]      Environment variables to set in the container.
63
64
65       --image=""      Container image to use for debug container.
66
67
68       --image-pull-policy=""      The image pull policy for the container. If
69       left empty, this value will not be specified  by  the  client  and  de‐
70       faulted by the server.
71
72
73       -q, --quiet=false      If true, suppress informational messages.
74
75
76       --replace=false       When  used  with '--copy-to', delete the original
77       Pod.
78
79
80       --same-node=false      When used with '--copy-to', schedule the copy of
81       target Pod on the same node.
82
83
84       --set-image=[]       When  used  with '--copy-to', a list of name=image
85       pairs for changing container images, similar to how 'kubectl set image'
86       works.
87
88
89       --share-processes=true       When used with '--copy-to', enable process
90       namespace sharing in the copy.
91
92
93       -i, --stdin=false      Keep stdin open on the container(s) in the  pod,
94       even if nothing is attached.
95
96
97       --target=""      When using an ephemeral container, target processes in
98       this container name.
99
100
101       -t, --tty=false      Allocate a TTY for the debugging container.
102
103
104

OPTIONS INHERITED FROM PARENT COMMANDS

106       --as=""      Username to impersonate for the operation. User could be a
107       regular user or a service account in a namespace.
108
109
110       --as-group=[]       Group  to  impersonate for the operation, this flag
111       can be repeated to specify multiple groups.
112
113
114       --as-uid=""      UID to impersonate for the operation.
115
116
117       --azure-container-registry-config=""      Path to the  file  containing
118       Azure container registry configuration information.
119
120
121       --cache-dir="/builddir/.kube/cache"      Default cache directory
122
123
124       --certificate-authority=""      Path to a cert file for the certificate
125       authority
126
127
128       --client-certificate=""      Path to a client certificate file for TLS
129
130
131       --client-key=""      Path to a client key file for TLS
132
133
134       --cluster=""      The name of the kubeconfig cluster to use
135
136
137       --context=""      The name of the kubeconfig context to use
138
139
140       --insecure-skip-tls-verify=false      If true, the server's certificate
141       will not be checked for validity. This will make your HTTPS connections
142       insecure
143
144
145       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
146       quests.
147
148
149       --match-server-version=false        Require  server  version  to  match
150       client version
151
152
153       -n, --namespace=""      If present, the namespace scope  for  this  CLI
154       request
155
156
157       --password=""      Password for basic authentication to the API server
158
159
160       --profile="none"         Name   of   profile   to   capture.   One   of
161       (none|cpu|heap|goroutine|threadcreate|block|mutex)
162
163
164       --profile-output="profile.pprof"      Name of the  file  to  write  the
165       profile to
166
167
168       --request-timeout="0"       The length of time to wait before giving up
169       on a single server request. Non-zero values  should  contain  a  corre‐
170       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
171       out requests.
172
173
174       -s, --server=""      The address and port of the Kubernetes API server
175
176
177       --tls-server-name=""      Server name to  use  for  server  certificate
178       validation.  If  it  is  not provided, the hostname used to contact the
179       server is used
180
181
182       --token=""      Bearer token for authentication to the API server
183
184
185       --user=""      The name of the kubeconfig user to use
186
187
188       --username=""      Username for basic authentication to the API server
189
190
191       --version=false      Print version information and quit
192
193
194       --warnings-as-errors=false      Treat warnings received from the server
195       as errors and exit with a non-zero exit code
196
197
198

EXAMPLE

200                # Create an interactive debugging session in pod mypod and immediately attach to it.
201                # (requires the EphemeralContainers feature to be enabled in the cluster)
202                kubectl debug mypod -it --image=busybox
203
204                # Create a debug container named debugger using a custom automated debugging image.
205                # (requires the EphemeralContainers feature to be enabled in the cluster)
206                kubectl debug --image=myproj/debug-tools -c debugger mypod
207
208                # Create a copy of mypod adding a debug container and attach to it
209                kubectl debug mypod -it --image=busybox --copy-to=my-debugger
210
211                # Create a copy of mypod changing the command of mycontainer
212                kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh
213
214                # Create a copy of mypod changing all container images to busybox
215                kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox
216
217                # Create a copy of mypod adding a debug container and changing container images
218                kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug
219
220                # Create an interactive debugging session on a node and immediately attach to it.
221                # The container will run in the host namespaces and the host's filesystem will be mounted at /host
222                kubectl debug node/mynode -it --image=busybox
223
224
225
226

SEE ALSO

228       kubectl(1),
229
230
231

HISTORY

233       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
234       com) based on the kubernetes source material, but hopefully  they  have
235       been automatically generated since!
236
237
238
239Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum