Skip to content

Commit 85d1e80

Browse files
authored
Merge pull request #52415 from my-git9/npa-3337
[zh-cn]sync kubectl_label/_index.md
2 parents c56887b + 609f6c3 commit 85d1e80

File tree

1 file changed

+51
-65
lines changed
  • content/zh-cn/docs/reference/kubectl/generated/kubectl_label

1 file changed

+51
-65
lines changed

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

Lines changed: 51 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ Update the labels on a resource.
3030
* 如果 --overwrite 为 true,则现有标签可以被覆盖,否则尝试覆盖标签将导致错误。
3131
* 如果指定了 --resource-version,则更新将使用此资源版本,否则将使用现有的资源版本。
3232

33-
<!--
34-
```
35-
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
36-
```
37-
-->
3833
```shell
3934
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
4035
```
@@ -43,45 +38,45 @@ kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_
4338

4439
<!--
4540
```
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-
6459
```
6560
-->
6661
```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-
8580
```
8681

8782
## {{% heading "options" %}}
@@ -435,30 +430,6 @@ The name of the kubeconfig context to use
435430
</p></td>
436431
</tr>
437432

438-
<tr>
439-
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--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-
462433
<tr>
463434
<td colspan="2">--disable-compression</td>
464435
</tr>
@@ -495,6 +466,21 @@ CLI 请求要使用的 kubeconfig 文件的路径。
495466
</p></td>
496467
</tr>
497468

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+
498484
<tr>
499485
<td colspan="2">--match-server-version</td>
500486
</tr>

0 commit comments

Comments
 (0)