@@ -36,6 +36,11 @@ Debug cluster resources using interactive debugging containers.
36
36
* 工作负载:向已运行的 Pod 中添加临时容器,例如在不重启 Pod 的情况下添加调试工具。
37
37
* 节点:新建一个在节点的主机命名空间中运行并可以访问节点文件系统的 Pod。
38
38
39
+ <!--
40
+ Note: When a non-root user is configured for the entire target Pod, some capabilities granted by debug profile may not work.
41
+ -->
42
+ 注意:当为目标 Pod 配置了非 root 用户时,由调试模式授予的某些能力可能无法工作。
43
+
39
44
``` shell
40
45
kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]
41
46
```
@@ -45,15 +50,30 @@ kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]
45
50
<!--
46
51
```
47
52
# Create an interactive debugging session in pod mypod and immediately attach to it.
53
+ kubectl debug mypod -it --image=busybox
54
+
48
55
# Create an interactive debugging session for the pod in the file pod.yaml and immediately attach to it.
49
56
# (requires the EphemeralContainers feature to be enabled in the cluster)
57
+ kubectl debug -f pod.yaml -it --image=busybox
58
+
50
59
# Create a debug container named debugger using a custom automated debugging image.
60
+ kubectl debug --image=myproj/debug-tools -c debugger mypod
61
+
51
62
# Create a copy of mypod adding a debug container and attach to it
63
+ kubectl debug mypod -it --image=busybox --copy-to=my-debugger
64
+
52
65
# Create a copy of mypod changing the command of mycontainer
66
+ kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh
67
+
53
68
# Create a copy of mypod changing all container images to busybox
69
+ kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox
70
+
54
71
# Create a copy of mypod adding a debug container and changing container images
72
+ kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug
73
+
55
74
# Create an interactive debugging session on a node and immediately attach to it.
56
75
# The container will run in the host namespaces and the host's filesystem will be mounted at /host
76
+ kubectl debug node/mynode -it --image=busybox
57
77
```
58
78
-->
59
79
``` shell
@@ -86,7 +106,7 @@ kubectl debug node/mynode -it --image=busybox
86
106
87
107
## {{% heading "options" %}}
88
108
89
- <table style =" width : 100% ; table-layout : fixed ;" >
109
+ <table style =" width : 100% ; table-layout : fixed ;" >
90
110
<colgroup >
91
111
<col span =" 1 " style =" width : 10px ;" />
92
112
<col span =" 1 " />
@@ -102,7 +122,8 @@ kubectl debug node/mynode -it --image=busybox
102
122
If specified, everything after -- will be passed to the new container as Args instead of Command.
103
123
-->
104
124
如果指定,` -- ` 之后的所有内容将作为 Args 而不是作为 Command 传递给新容器。
105
- </p ></td >
125
+ </p >
126
+ </td >
106
127
</tr >
107
128
108
129
<tr >
@@ -113,9 +134,10 @@ If specified, everything after -- will be passed to the new container as Args in
113
134
<!--
114
135
If true, wait for the container to start running, and then attach as if 'kubectl attach ...' were called. Default false, unless '-i/--stdin' is set, in which case the default is true.
115
136
-->
116
- 如果为 true,则等待容器开始运行,然后就像以前调用 “kubectl attach ...” 一样执行挂接操作。
117
- 默认为 false,如果设置了 “-i/--stdin”,则默认为 true。
118
- </p ></td >
137
+ 如果为 true,则等待容器开始运行,然后就像以前调用 "kubectl attach ..." 一样执行挂接操作。
138
+ 默认为 false,如果设置了 "-i/--stdin",则默认为 true。
139
+ </p >
140
+ </td >
119
141
</tr >
120
142
121
143
<tr >
@@ -127,7 +149,8 @@ If true, wait for the container to start running, and then attach as if 'kubectl
127
149
Container name to use for debug container.
128
150
-->
129
151
调试容器要使用的容器名称。
130
- </p ></td >
152
+ </p >
153
+ </td >
131
154
</tr >
132
155
133
156
<tr >
@@ -139,7 +162,8 @@ Container name to use for debug container.
139
162
Create a copy of the target Pod with this name.
140
163
-->
141
164
创建目标 Pod 的副本,并将副本命名为指定名称。
142
- </p ></td >
165
+ </p >
166
+ </td >
143
167
</tr >
144
168
145
169
<tr >
@@ -157,15 +181,16 @@ Path to a JSON or YAML file containing a partial container spec to customize bui
157
181
</tr >
158
182
159
183
<tr >
160
- <td colspan =" 2 " >--env stringToString  ;  ;  ;  ;  ; <!-- Default:--> 默认值:[]</td >
184
+ <td colspan =" 2 " >--env stringToString  ;  ;  ;  ;  ; <!-- Default: [] --> 默认值:[]</td >
161
185
</tr >
162
186
<tr >
163
187
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
164
188
<!--
165
189
Environment variables to set in the container.
166
190
-->
167
191
要在容器中设置的环境变量。
168
- </p ></td >
192
+ </p >
193
+ </td >
169
194
</tr >
170
195
171
196
<tr >
@@ -177,7 +202,8 @@ Environment variables to set in the container.
177
202
identifying the resource to debug
178
203
-->
179
204
标识要调试的资源。
180
- </p ></td >
205
+ </p >
206
+ </td >
181
207
</tr >
182
208
183
209
<tr >
@@ -189,7 +215,8 @@ identifying the resource to debug
189
215
help for debug
190
216
-->
191
217
debug 操作的帮助命令。
192
- </p ></td >
218
+ </p >
219
+ </td >
193
220
</tr >
194
221
195
222
<tr >
@@ -201,7 +228,8 @@ debug 操作的帮助命令。
201
228
Container image to use for debug container.
202
229
-->
203
230
调试容器要使用的容器镜像。
204
- </p ></td >
231
+ </p >
232
+ </td >
205
233
</tr >
206
234
207
235
<tr >
@@ -213,7 +241,8 @@ Container image to use for debug container.
213
241
The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server.
214
242
-->
215
243
容器的镜像拉取策略。如果留空,此值将不会由客户端指定,而是默认由服务器指定。
216
- </p ></td >
244
+ </p >
245
+ </td >
217
246
</tr >
218
247
219
248
<tr >
@@ -227,11 +256,12 @@ If true, keep the original pod annotations.(This flag only works when used with
227
256
-->
228
257
如果为真,则保留原始 Pod 的注解。
229
258
(此标志仅与 '--copy-to' 一起使用时才有效)
230
- </p ></td >
259
+ </p >
260
+ </td >
231
261
</tr >
232
262
233
263
<tr >
234
- <td colspan =" 2 " >--keep-init-containers  ;  ;  ;  ;  ; Default: true</td >
264
+ <td colspan =" 2 " >--keep-init-containers  ;  ;  ;  ;  ; <!-- Default: true --> 默认值: true</td >
235
265
</tr >
236
266
<tr >
237
267
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
@@ -283,7 +313,8 @@ If true, keep the original pod readiness probes.(This flag only works when used
283
313
-->
284
314
如果为真,则保留原始 Pod 的就绪性探测。
285
315
(此标志仅与 '--copy-to; 一起使用时才有效)
286
- </p ></td >
316
+ </p >
317
+ </td >
287
318
</tr >
288
319
289
320
<tr >
@@ -297,19 +328,21 @@ If true, keep the original startup probes.(This flag only works when used with '
297
328
-->
298
329
如果为真,则保留原始 Pod 的启动性检测。
299
330
(此标志仅与 '--copy-to' 一起使用时才有效)
300
- </p ></td >
331
+ </p >
332
+ </td >
301
333
</tr >
302
334
303
335
<tr >
304
- <td colspan =" 2 " >--profile string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"legacy"</td >
336
+ <td colspan =" 2 " >--profile string  ;  ;  ;  ;  ; <!-- Default: "legacy" --> 默认值:"legacy"</td >
305
337
</tr >
306
338
<tr >
307
339
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
308
340
<!--
309
341
Options are "legacy", "general", "baseline", "netadmin", "restricted" or "sysadmin".
310
342
-->
311
343
可选项包括 "legacy"、"general"、"baseline"、"netadmin"、"restricted" 或 "sysadmin"。
312
- </p ></td >
344
+ </p >
345
+ </td >
313
346
</tr >
314
347
315
348
<tr >
@@ -321,7 +354,8 @@ Options are "legacy", "general", "baseline", "
321
354
If true, suppress informational messages.
322
355
-->
323
356
如果为 true,则抑制资讯类消息。
324
- </p ></td >
357
+ </p >
358
+ </td >
325
359
</tr >
326
360
327
361
<tr >
@@ -333,7 +367,8 @@ If true, suppress informational messages.
333
367
When used with '--copy-to', delete the original Pod.
334
368
-->
335
369
当与 “--copy-to” 一起使用时,删除原来的 Pod。
336
- </p ></td >
370
+ </p >
371
+ </td >
337
372
</tr >
338
373
339
374
<tr >
@@ -345,31 +380,34 @@ When used with '--copy-to', delete the original Pod.
345
380
When used with '--copy-to', schedule the copy of target Pod on the same node.
346
381
-->
347
382
当与 “--copy-to” 一起使用时,将目标 Pod 的副本调度到同一个节点上。
348
- </p ></td >
383
+ </p >
384
+ </td >
349
385
</tr >
350
386
351
387
<tr >
352
- <td colspan =" 2 " >--set-image stringToString  ;  ;  ;  ;  ; <!-- Default:--> 默认值:[]</td >
388
+ <td colspan =" 2 " >--set-image stringToString  ;  ;  ;  ;  ; <!-- Default: [] --> 默认值:[]</td >
353
389
</tr >
354
390
<tr >
355
391
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
356
392
<!--
357
393
When used with '--copy-to', a list of name=image pairs for changing container images, similar to how 'kubectl set image' works.
358
394
-->
359
395
当与 “--copy-to” 一起使用时,提供一个 name=image 对的列表以更改容器镜像,类似于 ` kubectl set image ` 的工作方式。
360
- </p ></td >
396
+ </p >
397
+ </td >
361
398
</tr >
362
399
363
400
<tr >
364
- <td colspan =" 2 " >--share-processes  ;  ;  ;  ;  ; <!-- Default:--> 默认值:true</td >
401
+ <td colspan =" 2 " >--share-processes  ;  ;  ;  ;  ; <!-- Default: true --> 默认值:true</td >
365
402
</tr >
366
403
<tr >
367
404
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
368
405
<!--
369
406
When used with '--copy-to', enable process namespace sharing in the copy.
370
407
-->
371
408
当与 “--copy-to” 一起使用时,在副本中启用进程命名空间共享。
372
- </p ></td >
409
+ </p >
410
+ </td >
373
411
</tr >
374
412
375
413
<tr >
@@ -381,7 +419,8 @@ When used with '--copy-to', enable process namespace sharing in the copy.
381
419
Keep stdin open on the container(s) in the pod, even if nothing is attached.
382
420
-->
383
421
即使什么都没挂接,也要保持 Pod 中容器上的标准输入处于打开状态。
384
- </p ></td >
422
+ </p >
423
+ </td >
385
424
</tr >
386
425
387
426
<tr >
@@ -393,7 +432,8 @@ Keep stdin open on the container(s) in the pod, even if nothing is attached.
393
432
When using an ephemeral container, target processes in this container name.
394
433
-->
395
434
当使用临时容器时,将目标锁定为名称所指定的容器中的进程。
396
- </p ></td >
435
+ </p >
436
+ </td >
397
437
</tr >
398
438
399
439
<tr >
@@ -413,7 +453,7 @@ Allocate a TTY for the debugging container.
413
453
414
454
## {{% heading "parentoptions" %}}
415
455
416
- <table style =" width : 100% ; table-layout : fixed ;" >
456
+ <table style =" width : 100% ; table-layout : fixed ;" >
417
457
<colgroup >
418
458
<col span =" 1 " style =" width : 10px ;" />
419
459
<col span =" 1 " />
@@ -457,7 +497,7 @@ UID to impersonate for the operation.
457
497
</tr >
458
498
459
499
<tr >
460
- <td colspan =" 2 " >--cache-dir string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"$HOME/.kube/cache"</td >
500
+ <td colspan =" 2 " >--cache-dir string  ;  ;  ;  ;  ; <!-- Default: "$HOME/.kube/cache" --> 默认值:"$HOME/.kube/cache"</td >
461
501
</tr >
462
502
<tr >
463
503
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -529,7 +569,7 @@ The name of the kubeconfig context to use
529
569
</tr >
530
570
531
571
<tr >
532
- <td colspan =" 2 " >--default-not-ready-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default:--> 默认值:300</td >
572
+ <td colspan =" 2 " >--default-not-ready-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default: 300 --> 默认值:300</td >
533
573
</tr >
534
574
<tr >
535
575
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -541,7 +581,7 @@ Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is
541
581
</tr >
542
582
543
583
<tr >
544
- <td colspan =" 2 " >--default-unreachable-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default:--> 默认值:300</td >
584
+ <td colspan =" 2 " >--default-unreachable-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default: 300 --> 默认值:300</td >
545
585
</tr >
546
586
<tr >
547
587
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -625,7 +665,7 @@ Password for basic authentication to the API server
625
665
</tr >
626
666
627
667
<tr >
628
- <td colspan =" 2 " >--profile-output string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"profile.pprof"</td >
668
+ <td colspan =" 2 " >--profile-output string  ;  ;  ;  ;  ; <!-- Default: "profile.pprof" --> 默认值:"profile.pprof"</td >
629
669
</tr >
630
670
<tr >
631
671
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -637,7 +677,7 @@ Name of the file to write the profile to
637
677
</tr >
638
678
639
679
<tr >
640
- <td colspan =" 2 " >--request-timeout string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"0"</td >
680
+ <td colspan =" 2 " >--request-timeout string  ;  ;  ;  ;  ; <!-- Default: "0" --> 默认值:"0"</td >
641
681
</tr >
642
682
<tr >
643
683
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -662,7 +702,7 @@ Kubernetes API 服务器的地址和端口。
662
702
</tr >
663
703
664
704
<tr >
665
- <td colspan =" 2 " >--storage-driver-buffer-duration duration  ;  ;  ;  ;  ; <!-- Default:--> 默认值:1m0s</td >
705
+ <td colspan =" 2 " >--storage-driver-buffer-duration duration  ;  ;  ;  ;  ; <!-- Default: 1m0s --> 默认值:1m0s</td >
666
706
</tr >
667
707
<tr >
668
708
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -674,7 +714,7 @@ Writes in the storage driver will be buffered for this duration, and committed t
674
714
</tr >
675
715
676
716
<tr >
677
- <td colspan =" 2 " >--storage-driver-db string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"cadvisor"</td >
717
+ <td colspan =" 2 " >--storage-driver-db string  ;  ;  ;  ;  ; <!-- Default: "cadvisor" --> 默认值:"cadvisor"</td >
678
718
</tr >
679
719
<tr >
680
720
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -686,7 +726,7 @@ database name
686
726
</tr >
687
727
688
728
<tr >
689
- <td colspan =" 2 " >--storage-driver-host string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"localhost:8086"</td >
729
+ <td colspan =" 2 " >--storage-driver-host string  ;  ;  ;  ;  ; <!-- Default: "localhost:8086" --> 默认值:"localhost:8086"</td >
690
730
</tr >
691
731
<tr >
692
732
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -698,7 +738,7 @@ database host:port
698
738
</tr >
699
739
700
740
<tr >
701
- <td colspan =" 2 " >--storage-driver-password string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"root"</td >
741
+ <td colspan =" 2 " >--storage-driver-password string  ;  ;  ;  ;  ; <!-- Default: "root" --> 默认值:"root"</td >
702
742
</tr >
703
743
<tr >
704
744
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -722,7 +762,7 @@ use secure connection with database
722
762
</tr >
723
763
724
764
<tr >
725
- <td colspan =" 2 " >--storage-driver-table string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"stats"</td >
765
+ <td colspan =" 2 " >--storage-driver-table string  ;  ;  ;  ;  ; <!-- Default: "stats" --> 默认值:"stats"</td >
726
766
</tr >
727
767
<tr >
728
768
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
@@ -734,7 +774,7 @@ table name
734
774
</tr >
735
775
736
776
<tr >
737
- <td colspan =" 2 " >--storage-driver-user string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"root"</td >
777
+ <td colspan =" 2 " >--storage-driver-user string  ;  ;  ;  ;  ; <!-- Default: "root" --> 默认值:"root"</td >
738
778
</tr >
739
779
<tr >
740
780
<td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
0 commit comments