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       -f, --filename=[]      identifying the resource to debug
66
67
68       --image=""      Container image to use for debug container.
69
70
71       --image-pull-policy=""      The image pull policy for the container. If
72       left empty, this value will not be specified  by  the  client  and  de‐
73       faulted by the server.
74
75
76       --profile="legacy"       Debugging profile. Options are "legacy", "gen‐
77       eral", "baseline", "netadmin", or "restricted".
78
79
80       -q, --quiet=false      If true, suppress informational messages.
81
82
83       --replace=false      When used with '--copy-to',  delete  the  original
84       Pod.
85
86
87       --same-node=false      When used with '--copy-to', schedule the copy of
88       target Pod on the same node.
89
90
91       --set-image=[]      When used with '--copy-to', a  list  of  name=image
92       pairs for changing container images, similar to how 'kubectl set image'
93       works.
94
95
96       --share-processes=true      When used with '--copy-to', enable  process
97       namespace sharing in the copy.
98
99
100       -i,  --stdin=false      Keep stdin open on the container(s) in the pod,
101       even if nothing is attached.
102
103
104       --target=""      When using an ephemeral container, target processes in
105       this container name.
106
107
108       -t, --tty=false      Allocate a TTY for the debugging container.
109
110
111

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

237       kubectl(1),
238
239
240

HISTORY

242       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
243       com)  based  on the kubernetes source material, but hopefully they have
244       been automatically generated since!
245
246
247
248Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum