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       --profile="legacy"      Debugging profile.
74
75
76       -q, --quiet=false      If true, suppress informational messages.
77
78
79       --replace=false       When  used  with '--copy-to', delete the original
80       Pod.
81
82
83       --same-node=false      When used with '--copy-to', schedule the copy of
84       target Pod on the same node.
85
86
87       --set-image=[]       When  used  with '--copy-to', a list of name=image
88       pairs for changing container images, similar to how 'kubectl set image'
89       works.
90
91
92       --share-processes=true       When used with '--copy-to', enable process
93       namespace sharing in the copy.
94
95
96       -i, --stdin=false      Keep stdin open on the container(s) in the  pod,
97       even if nothing is attached.
98
99
100       --target=""      When using an ephemeral container, target processes in
101       this container name.
102
103
104       -t, --tty=false      Allocate a TTY for the debugging container.
105
106
107

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

231       kubectl(1),
232
233
234

HISTORY

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