@@ -30,11 +30,6 @@ Update the labels on a resource.
30
30
* 如果 --overwrite 为 true,则现有标签可以被覆盖,否则尝试覆盖标签将导致错误。
31
31
* 如果指定了 --resource-version,则更新将使用此资源版本,否则将使用现有的资源版本。
32
32
33
- <!--
34
- ```
35
- kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
36
- ```
37
- -->
38
33
``` shell
39
34
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version= version]
40
35
```
@@ -43,45 +38,45 @@ kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_
43
38
44
39
<!--
45
40
```
46
- # Update pod 'foo' with the label 'unhealthy' and the value 'true'
47
- kubectl label pods foo unhealthy=true
48
-
49
- # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value
50
- kubectl label --overwrite pods foo status=unhealthy
51
-
52
- # Update all pods in the namespace
53
- kubectl label pods --all status=unhealthy
54
-
55
- # Update a pod identified by the type and name in "pod.json"
56
- kubectl label -f pod.json status=unhealthy
57
-
58
- # Update pod 'foo' only if the resource is unchanged from version 1
59
- kubectl label pods foo status=unhealthy --resource-version=1
60
-
61
- # Update pod 'foo' by removing a label named 'bar' if it exists
62
- # Does not require the --overwrite flag
63
- kubectl label pods foo bar-
41
+ # Update pod 'foo' with the label 'unhealthy' and the value 'true'
42
+ kubectl label pods foo unhealthy=true
43
+
44
+ # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value
45
+ kubectl label --overwrite pods foo status=unhealthy
46
+
47
+ # Update all pods in the namespace
48
+ kubectl label pods --all status=unhealthy
49
+
50
+ # Update a pod identified by the type and name in "pod.json"
51
+ kubectl label -f pod.json status=unhealthy
52
+
53
+ # Update pod 'foo' only if the resource is unchanged from version 1
54
+ kubectl label pods foo status=unhealthy --resource-version=1
55
+
56
+ # Update pod 'foo' by removing a label named 'bar' if it exists
57
+ # Does not require the --overwrite flag
58
+ kubectl label pods foo bar-
64
59
```
65
60
-->
66
61
``` shell
67
- # 使用标签 'unhealthy' 和值 'true' 更新 Pod 'foo'
68
- kubectl label pods foo unhealthy=true
69
-
70
- # 使用标签 'status' 和值 'unhealthy' 更新 Pod 'foo',覆盖所有现有值
71
- kubectl label --overwrite pods foo status=unhealthy
72
-
73
- # 更新命名空间中的所有 Pod
74
- kubectl label pods --all status=unhealthy
75
-
76
- # 更新由 "pod.json" 中的 type 和 name 标识的 Pod
77
- kubectl label -f pod.json status=unhealthy
78
-
79
- # 仅在资源版本为 1 且未更改时更新 Pod 'foo'
80
- kubectl label pods foo status=unhealthy --resource-version=1
81
-
82
- # 如果存在名为 'bar' 的标签,则通过移除此标签来更新 Pod 'foo'
83
- # 不需要 --overwrite 标志
84
- kubectl label pods foo bar-
62
+ # 使用标签 'unhealthy' 和值 'true' 更新 Pod 'foo'
63
+ kubectl label pods foo unhealthy=true
64
+
65
+ # 使用标签 'status' 和值 'unhealthy' 更新 Pod 'foo',覆盖所有现有值
66
+ kubectl label --overwrite pods foo status=unhealthy
67
+
68
+ # 更新命名空间中的所有 Pod
69
+ kubectl label pods --all status=unhealthy
70
+
71
+ # 更新由 "pod.json" 中的 type 和 name 标识的 Pod
72
+ kubectl label -f pod.json status=unhealthy
73
+
74
+ # 仅在资源版本为 1 且未更改时更新 Pod 'foo'
75
+ kubectl label pods foo status=unhealthy --resource-version=1
76
+
77
+ # 如果存在名为 'bar' 的标签,则通过移除此标签来更新 Pod 'foo'
78
+ # 不需要 --overwrite 标志
79
+ kubectl label pods foo bar-
85
80
```
86
81
87
82
## {{% heading "options" %}}
@@ -435,30 +430,6 @@ The name of the kubeconfig context to use
435
430
</p ></td >
436
431
</tr >
437
432
438
- <tr >
439
- <td colspan =" 2 " >--default-not-ready-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default:--> 默认值:300</td >
440
- </tr >
441
- <tr >
442
- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
443
- <!--
444
- Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.
445
- -->
446
- 设置针对 notReady: NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
447
- </p ></td >
448
- </tr >
449
-
450
- <tr >
451
- <td colspan =" 2 " >--default-unreachable-toleration-seconds int  ;  ;  ;  ;  ; <!-- Default:--> 默认值:300</td >
452
- </tr >
453
- <tr >
454
- <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" ><p >
455
- <!--
456
- Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.
457
- -->
458
- 设置针对 unreachable: NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
459
- </p ></td >
460
- </tr >
461
-
462
433
<tr >
463
434
<td colspan =" 2 " >--disable-compression</td >
464
435
</tr >
@@ -495,6 +466,21 @@ CLI 请求要使用的 kubeconfig 文件的路径。
495
466
</p ></td >
496
467
</tr >
497
468
469
+ <tr >
470
+ <td colspan =" 2 " >--kuberc string</td >
471
+ </tr >
472
+ <tr >
473
+ <td ></td ><td style =" line-height : 130% ; word-wrap : break-word ;" >
474
+ <p >
475
+ <!--
476
+ Path 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.
477
+ -->
478
+ 用于偏好设置的 kuberc 文件的路径。可以通过导出 KUBECTL_KUBERC=false
479
+ 特性门控或关闭 KUBERC=off 特性门控来禁用此功能。
480
+ </p >
481
+ </td >
482
+ </tr >
483
+
498
484
<tr >
499
485
<td colspan =" 2 " >--match-server-version</td >
500
486
</tr >
0 commit comments