Skip to content

Commit 8edd2f2

Browse files
authored
Merge pull request #51531 from my-git9/npa-2332
[zh-cn]sync kubectl_debug
2 parents 2e9756e + 80199ab commit 8edd2f2

File tree

1 file changed

+80
-40
lines changed
  • content/zh-cn/docs/reference/kubectl/generated/kubectl_debug

1 file changed

+80
-40
lines changed

content/zh-cn/docs/reference/kubectl/generated/kubectl_debug/_index.md

Lines changed: 80 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ Debug cluster resources using interactive debugging containers.
3636
* 工作负载:向已运行的 Pod 中添加临时容器,例如在不重启 Pod 的情况下添加调试工具。
3737
* 节点:新建一个在节点的主机命名空间中运行并可以访问节点文件系统的 Pod。
3838

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+
3944
```shell
4045
kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]
4146
```
@@ -45,15 +50,30 @@ kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]
4550
<!--
4651
```
4752
# Create an interactive debugging session in pod mypod and immediately attach to it.
53+
kubectl debug mypod -it --image=busybox
54+
4855
# Create an interactive debugging session for the pod in the file pod.yaml and immediately attach to it.
4956
# (requires the EphemeralContainers feature to be enabled in the cluster)
57+
kubectl debug -f pod.yaml -it --image=busybox
58+
5059
# Create a debug container named debugger using a custom automated debugging image.
60+
kubectl debug --image=myproj/debug-tools -c debugger mypod
61+
5162
# 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+
5265
# Create a copy of mypod changing the command of mycontainer
66+
kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh
67+
5368
# Create a copy of mypod changing all container images to busybox
69+
kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox
70+
5471
# 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+
5574
# Create an interactive debugging session on a node and immediately attach to it.
5675
# 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
5777
```
5878
-->
5979
```shell
@@ -86,7 +106,7 @@ kubectl debug node/mynode -it --image=busybox
86106

87107
## {{% heading "options" %}}
88108

89-
<table style="width: 100%; table-layout: fixed;">
109+
<table style="width: 100%; table-layout: fixed;">
90110
<colgroup>
91111
<col span="1" style="width: 10px;" />
92112
<col span="1" />
@@ -102,7 +122,8 @@ kubectl debug node/mynode -it --image=busybox
102122
If specified, everything after -- will be passed to the new container as Args instead of Command.
103123
-->
104124
如果指定,`--` 之后的所有内容将作为 Args 而不是作为 Command 传递给新容器。
105-
</p></td>
125+
</p>
126+
</td>
106127
</tr>
107128

108129
<tr>
@@ -113,9 +134,10 @@ If specified, everything after -- will be passed to the new container as Args in
113134
<!--
114135
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.
115136
-->
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>
119141
</tr>
120142

121143
<tr>
@@ -127,7 +149,8 @@ If true, wait for the container to start running, and then attach as if 'kubectl
127149
Container name to use for debug container.
128150
-->
129151
调试容器要使用的容器名称。
130-
</p></td>
152+
</p>
153+
</td>
131154
</tr>
132155

133156
<tr>
@@ -139,7 +162,8 @@ Container name to use for debug container.
139162
Create a copy of the target Pod with this name.
140163
-->
141164
创建目标 Pod 的副本,并将副本命名为指定名称。
142-
</p></td>
165+
</p>
166+
</td>
143167
</tr>
144168

145169
<tr>
@@ -157,15 +181,16 @@ Path to a JSON or YAML file containing a partial container spec to customize bui
157181
</tr>
158182

159183
<tr>
160-
<td colspan="2">--env stringToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:[]</td>
184+
<td colspan="2">--env stringToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: []-->默认值:[]</td>
161185
</tr>
162186
<tr>
163187
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
164188
<!--
165189
Environment variables to set in the container.
166190
-->
167191
要在容器中设置的环境变量。
168-
</p></td>
192+
</p>
193+
</td>
169194
</tr>
170195

171196
<tr>
@@ -177,7 +202,8 @@ Environment variables to set in the container.
177202
identifying the resource to debug
178203
-->
179204
标识要调试的资源。
180-
</p></td>
205+
</p>
206+
</td>
181207
</tr>
182208

183209
<tr>
@@ -189,7 +215,8 @@ identifying the resource to debug
189215
help for debug
190216
-->
191217
debug 操作的帮助命令。
192-
</p></td>
218+
</p>
219+
</td>
193220
</tr>
194221

195222
<tr>
@@ -201,7 +228,8 @@ debug 操作的帮助命令。
201228
Container image to use for debug container.
202229
-->
203230
调试容器要使用的容器镜像。
204-
</p></td>
231+
</p>
232+
</td>
205233
</tr>
206234

207235
<tr>
@@ -213,7 +241,8 @@ Container image to use for debug container.
213241
The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server.
214242
-->
215243
容器的镜像拉取策略。如果留空,此值将不会由客户端指定,而是默认由服务器指定。
216-
</p></td>
244+
</p>
245+
</td>
217246
</tr>
218247

219248
<tr>
@@ -227,11 +256,12 @@ If true, keep the original pod annotations.(This flag only works when used with
227256
-->
228257
如果为真,则保留原始 Pod 的注解。
229258
(此标志仅与 '--copy-to' 一起使用时才有效)
230-
</p></td>
259+
</p>
260+
</td>
231261
</tr>
232262

233263
<tr>
234-
<td colspan="2">--keep-init-containers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: true</td>
264+
<td colspan="2">--keep-init-containers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: true-->默认值:true</td>
235265
</tr>
236266
<tr>
237267
<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
283313
-->
284314
如果为真,则保留原始 Pod 的就绪性探测。
285315
(此标志仅与 '--copy-to; 一起使用时才有效)
286-
</p></td>
316+
</p>
317+
</td>
287318
</tr>
288319

289320
<tr>
@@ -297,19 +328,21 @@ If true, keep the original startup probes.(This flag only works when used with '
297328
-->
298329
如果为真,则保留原始 Pod 的启动性检测。
299330
(此标志仅与 '--copy-to' 一起使用时才有效)
300-
</p></td>
331+
</p>
332+
</td>
301333
</tr>
302334

303335
<tr>
304-
<td colspan="2">--profile string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"legacy"</td>
336+
<td colspan="2">--profile string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "legacy"-->默认值:"legacy"</td>
305337
</tr>
306338
<tr>
307339
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
308340
<!--
309341
Options are &quot;legacy&quot;, &quot;general&quot;, &quot;baseline&quot;, &quot;netadmin&quot;, &quot;restricted&quot; or &quot;sysadmin&quot;.
310342
-->
311343
可选项包括 "legacy"、"general"、"baseline"、"netadmin"、"restricted" 或 "sysadmin"。
312-
</p></td>
344+
</p>
345+
</td>
313346
</tr>
314347

315348
<tr>
@@ -321,7 +354,8 @@ Options are &quot;legacy&quot;, &quot;general&quot;, &quot;baseline&quot;, &quot
321354
If true, suppress informational messages.
322355
-->
323356
如果为 true,则抑制资讯类消息。
324-
</p></td>
357+
</p>
358+
</td>
325359
</tr>
326360

327361
<tr>
@@ -333,7 +367,8 @@ If true, suppress informational messages.
333367
When used with '--copy-to', delete the original Pod.
334368
-->
335369
当与 “--copy-to” 一起使用时,删除原来的 Pod。
336-
</p></td>
370+
</p>
371+
</td>
337372
</tr>
338373

339374
<tr>
@@ -345,31 +380,34 @@ When used with '--copy-to', delete the original Pod.
345380
When used with '--copy-to', schedule the copy of target Pod on the same node.
346381
-->
347382
当与 “--copy-to” 一起使用时,将目标 Pod 的副本调度到同一个节点上。
348-
</p></td>
383+
</p>
384+
</td>
349385
</tr>
350386

351387
<tr>
352-
<td colspan="2">--set-image stringToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:[]</td>
388+
<td colspan="2">--set-image stringToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: []-->默认值:[]</td>
353389
</tr>
354390
<tr>
355391
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
356392
<!--
357393
When used with '--copy-to', a list of name=image pairs for changing container images, similar to how 'kubectl set image' works.
358394
-->
359395
当与 “--copy-to” 一起使用时,提供一个 name=image 对的列表以更改容器镜像,类似于 `kubectl set image` 的工作方式。
360-
</p></td>
396+
</p>
397+
</td>
361398
</tr>
362399

363400
<tr>
364-
<td colspan="2">--share-processes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:true</td>
401+
<td colspan="2">--share-processes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: true-->默认值:true</td>
365402
</tr>
366403
<tr>
367404
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
368405
<!--
369406
When used with '--copy-to', enable process namespace sharing in the copy.
370407
-->
371408
当与 “--copy-to” 一起使用时,在副本中启用进程命名空间共享。
372-
</p></td>
409+
</p>
410+
</td>
373411
</tr>
374412

375413
<tr>
@@ -381,7 +419,8 @@ When used with '--copy-to', enable process namespace sharing in the copy.
381419
Keep stdin open on the container(s) in the pod, even if nothing is attached.
382420
-->
383421
即使什么都没挂接,也要保持 Pod 中容器上的标准输入处于打开状态。
384-
</p></td>
422+
</p>
423+
</td>
385424
</tr>
386425

387426
<tr>
@@ -393,7 +432,8 @@ Keep stdin open on the container(s) in the pod, even if nothing is attached.
393432
When using an ephemeral container, target processes in this container name.
394433
-->
395434
当使用临时容器时,将目标锁定为名称所指定的容器中的进程。
396-
</p></td>
435+
</p>
436+
</td>
397437
</tr>
398438

399439
<tr>
@@ -413,7 +453,7 @@ Allocate a TTY for the debugging container.
413453

414454
## {{% heading "parentoptions" %}}
415455

416-
<table style="width: 100%; table-layout: fixed;">
456+
<table style="width: 100%; table-layout: fixed;">
417457
<colgroup>
418458
<col span="1" style="width: 10px;" />
419459
<col span="1" />
@@ -457,7 +497,7 @@ UID to impersonate for the operation.
457497
</tr>
458498

459499
<tr>
460-
<td colspan="2">--cache-dir string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"$HOME/.kube/cache"</td>
500+
<td colspan="2">--cache-dir string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "$HOME/.kube/cache"-->默认值:"$HOME/.kube/cache"</td>
461501
</tr>
462502
<tr>
463503
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -529,7 +569,7 @@ The name of the kubeconfig context to use
529569
</tr>
530570

531571
<tr>
532-
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:300</td>
572+
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: 300-->默认值:300</td>
533573
</tr>
534574
<tr>
535575
<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
541581
</tr>
542582

543583
<tr>
544-
<td colspan="2">--default-unreachable-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:300</td>
584+
<td colspan="2">--default-unreachable-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: 300-->默认值:300</td>
545585
</tr>
546586
<tr>
547587
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -625,7 +665,7 @@ Password for basic authentication to the API server
625665
</tr>
626666

627667
<tr>
628-
<td colspan="2">--profile-output string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"profile.pprof"</td>
668+
<td colspan="2">--profile-output string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "profile.pprof"-->默认值:"profile.pprof"</td>
629669
</tr>
630670
<tr>
631671
<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
637677
</tr>
638678

639679
<tr>
640-
<td colspan="2">--request-timeout string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"0"</td>
680+
<td colspan="2">--request-timeout string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "0"-->默认值:"0"</td>
641681
</tr>
642682
<tr>
643683
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -662,7 +702,7 @@ Kubernetes API 服务器的地址和端口。
662702
</tr>
663703

664704
<tr>
665-
<td colspan="2">--storage-driver-buffer-duration duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:1m0s</td>
705+
<td colspan="2">--storage-driver-buffer-duration duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: 1m0s-->默认值:1m0s</td>
666706
</tr>
667707
<tr>
668708
<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
674714
</tr>
675715

676716
<tr>
677-
<td colspan="2">--storage-driver-db string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"cadvisor"</td>
717+
<td colspan="2">--storage-driver-db string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "cadvisor"-->默认值:"cadvisor"</td>
678718
</tr>
679719
<tr>
680720
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -686,7 +726,7 @@ database name
686726
</tr>
687727

688728
<tr>
689-
<td colspan="2">--storage-driver-host string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"localhost:8086"</td>
729+
<td colspan="2">--storage-driver-host string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "localhost:8086"-->默认值:"localhost:8086"</td>
690730
</tr>
691731
<tr>
692732
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -698,7 +738,7 @@ database host:port
698738
</tr>
699739

700740
<tr>
701-
<td colspan="2">--storage-driver-password string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"root"</td>
741+
<td colspan="2">--storage-driver-password string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "root"-->默认值:"root"</td>
702742
</tr>
703743
<tr>
704744
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -722,7 +762,7 @@ use secure connection with database
722762
</tr>
723763

724764
<tr>
725-
<td colspan="2">--storage-driver-table string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"stats"</td>
765+
<td colspan="2">--storage-driver-table string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "stats"-->默认值:"stats"</td>
726766
</tr>
727767
<tr>
728768
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
@@ -734,7 +774,7 @@ table name
734774
</tr>
735775

736776
<tr>
737-
<td colspan="2">--storage-driver-user string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"root"</td>
777+
<td colspan="2">--storage-driver-user string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: "root"-->默认值:"root"</td>
738778
</tr>
739779
<tr>
740780
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>

0 commit comments

Comments
 (0)