@@ -3,12 +3,16 @@ title: kubectl attach
33content_type : tool-reference
44weight : 30
55no_list : true
6+ description : >-
7+ 连接到正在运行的容器
68---
79<!--
810title: kubectl attach
911content_type: tool-reference
1012weight: 30
1113auto_generated: true
14+ description: >-
15+ Attach to a running container
1216no_list: true
1317-->
1418
@@ -77,7 +81,7 @@ kubectl attach rs/nginx
7781Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen
7882-->
7983容器名称。
80- 如果省略,则使用 kubectl.kubernetes.io/default-container 注解来选择要挂接的容器,
84+ 如果省略,则使用 < code > kubectl.kubernetes.io/default-container</ code > 注解来选择要挂接的容器,
8185否则将选择 Pod 中的第一个容器。
8286</p >
8387</td >
@@ -169,7 +173,9 @@ Stdin 是一个 TTY。
169173<td colspan =" 2 " >--as string</td >
170174</tr >
171175<tr >
172- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
176+ <td ></td >
177+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
178+ <p >
173179<!--
174180Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
175181-->
@@ -182,7 +188,9 @@ Username to impersonate for the operation. User could be a regular user or a ser
182188<td colspan =" 2 " >--as-group strings</td >
183189</tr >
184190<tr >
185- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
191+ <td ></td >
192+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
193+ <p >
186194<!--
187195Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
188196-->
@@ -195,7 +203,9 @@ Group to impersonate for the operation, this flag can be repeated to specify mul
195203<td colspan =" 2 " >--as-uid string</td >
196204</tr >
197205<tr >
198- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
206+ <td ></td >
207+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
208+ <p >
199209<!--
200210UID to impersonate for the operation.
201211-->
@@ -208,7 +218,8 @@ UID to impersonate for the operation.
208218<td colspan =" 2 " >--as-user-extra strings</td >
209219</tr >
210220<tr >
211- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
221+ <td ></td >
222+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
212223<p >
213224<!--
214225User extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.
@@ -222,7 +233,9 @@ User extras to impersonate for the operation, this flag can be repeated to speci
222233<td colspan =" 2 " >--cache-dir string  ;  ;  ;  ;  ; <!-- Default: "$HOME/.kube/cache"--> 默认值:"$HOME/.kube/cache"</td >
223234</tr >
224235<tr >
225- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
236+ <td ></td >
237+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
238+ <p >
226239<!--
227240Default cache directory
228241-->
@@ -235,19 +248,24 @@ Default cache directory
235248<td colspan =" 2 " >--certificate-authority string</td >
236249</tr >
237250<tr >
238- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
251+ <td ></td >
252+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
253+ <p >
239254<!--
240255Path to a cert file for the certificate authority
241256-->
242257证书机构的证书文件的路径。
243- </p ></td >
258+ </p >
259+ </td >
244260</tr >
245261
246262<tr >
247263<td colspan =" 2 " >--client-certificate string</td >
248264</tr >
249265<tr >
250- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
266+ <td ></td >
267+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
268+ <p >
251269<!--
252270Path to a client certificate file for TLS
253271-->
@@ -260,7 +278,9 @@ TLS 客户端证书文件的路径。
260278<td colspan =" 2 " >--client-key string</td >
261279</tr >
262280<tr >
263- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
281+ <td ></td >
282+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
283+ <p >
264284<!--
265285Path to a client key file for TLS
266286-->
@@ -273,7 +293,9 @@ TLS 客户端密钥文件的路径。
273293<td colspan =" 2 " >--cluster string</td >
274294</tr >
275295<tr >
276- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
296+ <td ></td >
297+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
298+ <p >
277299<!--
278300The name of the kubeconfig cluster to use
279301-->
@@ -286,7 +308,9 @@ The name of the kubeconfig cluster to use
286308<td colspan =" 2 " >--context string</td >
287309</tr >
288310<tr >
289- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
311+ <td ></td >
312+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
313+ <p >
290314<!--
291315The name of the kubeconfig context to use
292316-->
@@ -299,7 +323,9 @@ The name of the kubeconfig context to use
299323<td colspan =" 2 " >--disable-compression</td >
300324</tr >
301325<tr >
302- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
326+ <td ></td >
327+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
328+ <p >
303329<!--
304330If true, opt-out of response compression for all requests to the server
305331-->
@@ -312,7 +338,9 @@ If true, opt-out of response compression for all requests to the server
312338<td colspan =" 2 " >--insecure-skip-tls-verify</td >
313339</tr >
314340<tr >
315- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
341+ <td ></td >
342+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
343+ <p >
316344<!--
317345If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
318346-->
@@ -325,7 +353,9 @@ If true, the server's certificate will not be checked for validity. This will ma
325353<td colspan =" 2 " >--kubeconfig string</td >
326354</tr >
327355<tr >
328- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
356+ <td ></td >
357+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
358+ <p >
329359<!--
330360Path to the kubeconfig file to use for CLI requests.
331361-->
@@ -338,7 +368,8 @@ CLI 请求要使用的 kubeconfig 文件的路径。
338368<td colspan =" 2 " >--kuberc string</td >
339369</tr >
340370<tr >
341- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
371+ <td ></td >
372+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
342373<p >
343374<!--
344375Path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
@@ -353,7 +384,9 @@ Path to the kuberc file to use for preferences. This can be disabled by exportin
353384<td colspan =" 2 " >--match-server-version</td >
354385</tr >
355386<tr >
356- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
387+ <td ></td >
388+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
389+ <p >
357390<!--
358391Require server version to match client version
359392-->
@@ -366,7 +399,9 @@ Require server version to match client version
366399<td colspan =" 2 " >-n, --namespace string</td >
367400</tr >
368401<tr >
369- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
402+ <td ></td >
403+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
404+ <p >
370405<!--
371406If present, the namespace scope for this CLI request
372407-->
@@ -379,7 +414,9 @@ If present, the namespace scope for this CLI request
379414<td colspan =" 2 " >--password string</td >
380415</tr >
381416<tr >
382- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
417+ <td ></td >
418+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
419+ <p >
383420<!--
384421Password for basic authentication to the API server
385422-->
@@ -392,7 +429,8 @@ Password for basic authentication to the API server
392429<td colspan =" 2 " >--profile string  ;  ;  ;  ;  ; <!-- Default: "none"--> 默认值:"none"</td >
393430</tr >
394431<tr >
395- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
432+ <td ></td >
433+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
396434<p >
397435<!--
398436Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex|trace)
@@ -406,7 +444,8 @@ Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|m
406444<td colspan =" 2 " >--profile-output string  ;  ;  ;  ;  ; <!-- Default: "profile.pprof"--> 默认值:"profile.pprof"</td >
407445</tr >
408446<tr >
409- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
447+ <td ></td >
448+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
410449<p >
411450<!--
412451Name of the file to write the profile to
@@ -420,7 +459,8 @@ Name of the file to write the profile to
420459<td colspan =" 2 " >--request-timeout string  ;  ;  ;  ;  ; <!-- Default: "0"--> 默认值:"0"</td >
421460</tr >
422461<tr >
423- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
462+ <td ></td >
463+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
424464<p >
425465<!--
426466The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
@@ -435,7 +475,8 @@ The length of time to wait before giving up on a single server request. Non-zero
435475<td colspan =" 2 " >-s, --server string</td >
436476</tr >
437477<tr >
438- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
478+ <td ></td >
479+ <td style =" line-height : 130% ; word-wrap : break-word ;" >
439480<p >
440481<!--
441482The address and port of the Kubernetes API server
@@ -547,7 +588,8 @@ database username
547588<td colspan =" 2 " >--tls-server-name string</td >
548589</tr >
549590<tr >
550- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
591+ <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
592+ <p >
551593<!--
552594Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
553595-->
@@ -560,7 +602,8 @@ Server name to use for server certificate validation. If it is not provided, the
560602<td colspan =" 2 " >--token string</td >
561603</tr >
562604<tr >
563- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
605+ <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
606+ <p >
564607<!--
565608Bearer token for authentication to the API server
566609-->
@@ -573,19 +616,22 @@ Bearer token for authentication to the API server
573616<td colspan =" 2 " >--user string</td >
574617</tr >
575618<tr >
576- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
619+ <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
620+ <p >
577621<!--
578622The name of the kubeconfig user to use
579623-->
580624要使用的 kubeconfig 用户的名称。
581- </p ></td >
625+ </p >
626+ </td >
582627</tr >
583628
584629<tr >
585630<td colspan =" 2 " >--username string</td >
586631</tr >
587632<tr >
588- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
633+ <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
634+ <p >
589635<!--
590636Username for basic authentication to the API server
591637-->
0 commit comments