Skip to content

Commit 3f7e250

Browse files
authored
Merge pull request #34977 from Michelle951/main
[zh-cn] try to improve content/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration.md
2 parents ad25aba + 0d30ba0 commit 3f7e250

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

content/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ content_type: concept
44
weight: 40
55
---
66

7+
78
<!-- overview -->
89
<!--
910
[_Node affinity_](/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
@@ -19,13 +20,13 @@ hard requirement). _Taints_ are the opposite -- they allow a node to repel a set
1920

2021
<!--
2122
22-
_Tolerations_ are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints. Tolerations allow scheduling but don't guarantee scheduling: the scheduler also [evaluates other parameters](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/) as part of its function.
23+
_Tolerations_ are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints. Tolerations allow scheduling but don't guarantee scheduling: the scheduler also [evaluates other parameters](/docs/concepts/scheduling-eviction/pod-priority-preemption/) as part of its function.
2324
2425
Taints and tolerations work together to ensure that pods are not scheduled
2526
onto inappropriate nodes. One or more taints are applied to a node; this
2627
marks that the node should not accept any pods that do not tolerate the taints.
2728
-->
28-
**容忍度(Toleration)** 是应用于 Pod 上的。容忍度允许调度器调度带有对应污点的节点
29+
**容忍度(Toleration)** 是应用于 Pod 上的。容忍度允许调度器调度带有对应污点的 Pod
2930
容忍度允许调度但并不保证调度:作为其功能的一部分,
3031
调度器也会[评估其他参数](/zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption/)
3132

@@ -89,7 +90,7 @@ tolerations:
8990
```
9091
9192
<!--
92-
Heres an example of a pod that uses tolerations:
93+
Here's an example of a pod that uses tolerations:
9394
-->
9495
这里是一个使用了容忍度的 Pod:
9596
@@ -104,14 +105,15 @@ The default value for `operator` is `Equal`.
104105
A toleration "matches" a taint if the keys are the same and the effects are the same, and:
105106

106107
* the `operator` is `Exists` (in which case no `value` should be specified), or
107-
* the `operator` is `Equal` and the `value`s are equal
108+
* the `operator` is `Equal` and the `value`s are equal.
108109
-->
109110
一个容忍度和一个污点相“匹配”是指它们有一样的键名和效果,并且:
110111

111112
* 如果 `operator` 是 `Exists` (此时容忍度不能指定 `value`),或者
112113
* 如果 `operator` 是 `Equal` ,则它们的 `value` 应该相等
113114

114115
{{< note >}}
116+
115117
<!--
116118
There are two special cases:
117119

@@ -130,7 +132,7 @@ An empty `effect` matches all effects with key `key1`.
130132

131133
<!--
132134
The above example used `effect` of `NoSchedule`. Alternatively, you can use `effect` of `PreferNoSchedule`.
133-
This is a "preference" or "soft" version of `NoSchedule` - the system will *try* to avoid placing a
135+
This is a "preference" or "soft" version of `NoSchedule` -- the system will *try* to avoid placing a
134136
pod that does not tolerate the taint on the node, but it is not required. The third kind of `effect` is
135137
`NoExecute`, described later.
136138
-->
@@ -147,7 +149,7 @@ remaining un-ignored taints have the indicated effects on the pod. In particular
147149
你可以给一个节点添加多个污点,也可以给一个 Pod 添加多个容忍度设置。
148150
Kubernetes 处理多个污点和容忍度的过程就像一个过滤器:从一个节点的所有污点开始遍历,
149151
过滤掉那些 Pod 中存在与之相匹配的容忍度的污点。余下未被过滤的污点的 effect 值决定了
150-
Pod 是否会被分配到该节点,特别是以下情况
152+
Pod 是否会被分配到该节点。需要注意以下情况
151153

152154
<!--
153155
* if there is at least one un-ignored taint with effect `NoSchedule` then Kubernetes will not schedule
@@ -161,7 +163,7 @@ scheduled onto the node (if it is not yet running on the node).
161163
* 如果未被忽略的污点中存在至少一个 effect 值为 `NoSchedule` 的污点,
162164
则 Kubernetes 不会将 Pod 调度到该节点。
163165
* 如果未被忽略的污点中不存在 effect 值为 `NoSchedule` 的污点,
164-
但是存在 effect 值为 `PreferNoSchedule` 的污点,
166+
但是存在至少一个 effect 值为 `PreferNoSchedule` 的污点,
165167
则 Kubernetes 会 **尝试** 不将 Pod 调度到该节点。
166168
* 如果未被忽略的污点中存在至少一个 effect 值为 `NoExecute` 的污点,
167169
则 Kubernetes 不会将 Pod 调度到该节点(如果 Pod 还未在节点上运行),
@@ -181,7 +183,7 @@ kubectl taint nodes node1 key2=value2:NoSchedule
181183
<!--
182184
And a pod has two tolerations:
183185
-->
184-
假定有一个 Pod,它有两个容忍度
186+
假定某个 Pod 有两个容忍度
185187

186188
```yaml
187189
tolerations:
@@ -207,7 +209,7 @@ one of the three that is not tolerated by the pod.
207209

208210
<!--
209211
Normally, if a taint with effect `NoExecute` is added to a node, then any pods that do
210-
not tolerate the taint will be evicted immediately, and any pods that do tolerate the
212+
not tolerate the taint will be evicted immediately, and pods that do tolerate the
211213
taint will never be evicted. However, a toleration with `NoExecute` effect can specify
212214
an optional `tolerationSeconds` field that dictates how long the pod will stay bound
213215
to the node after the taint is added. For example,
@@ -260,7 +262,7 @@ to the taint to the same set of nodes (e.g. `dedicated=groupName`), and the admi
260262
controller should additionally add a node affinity to require that the pods can only schedule
261263
onto nodes labeled with `dedicated=groupName`.
262264
-->
263-
* **专用节点**:如果你想将某些节点专门分配给特定的一组用户使用,你可以给这些节点添加一个污点(即,
265+
* **专用节点**:如果想将某些节点专门分配给特定的一组用户使用,你可以给这些节点添加一个污点(即,
264266
`kubectl taint nodes nodename dedicated=groupName:NoSchedule`),
265267
然后给这组用户的 Pod 添加一个相对应的容忍度
266268
(通过编写一个自定义的[准入控制器](/zh-cn/docs/reference/access-authn-authz/admission-controllers/),
@@ -282,7 +284,7 @@ toleration to pods that use the special hardware. As in the dedicated nodes use
282284
it is probably easiest to apply the tolerations using a custom
283285
[admission controller](/docs/reference/access-authn-authz/admission-controllers/).
284286
For example, it is recommended to use [Extended
285-
Resources](/docs/concepts/configuration/manage-compute-resources-container/#extended-resources)
287+
Resources](/docs/concepts/configuration/manage-resources-containers/#extended-resources)
286288
to represent the special hardware, taint your special hardware nodes with the
287289
extended resource name and run the
288290
[ExtendedResourceToleration](/docs/reference/access-authn-authz/admission-controllers/#extendedresourcetoleration)
@@ -326,7 +328,7 @@ when there are node problems, which is described in the next section.
326328
{{< feature-state for_k8s_version="v1.18" state="stable" >}}
327329

328330
<!--
329-
The `NoExecute` taint effect, which affects pods that are already
331+
The `NoExecute` taint effect, mentioned above, affects pods that are already
330332
running on the node as follows
331333

332334
* pods that do not tolerate the taint are evicted immediately
@@ -337,15 +339,15 @@ running on the node as follows
337339
-->
338340
前文提到过污点的效果值 `NoExecute` 会影响已经在节点上运行的 Pod,如下
339341

340-
* 如果 Pod 不能忍受这类污点,Pod 会马上被驱逐
342+
* 如果 Pod 不能忍受这类污点,Pod 会马上被驱逐
341343
* 如果 Pod 能够忍受这类污点,但是在容忍度定义中没有指定 `tolerationSeconds`,
342344
则 Pod 还会一直在这个节点上运行。
343345
* 如果 Pod 能够忍受这类污点,而且指定了 `tolerationSeconds`,
344346
则 Pod 还能在这个节点上继续运行这个指定的时间长度。
345347

346348
<!--
347-
The node controller automatically taints a node when certain conditions are
348-
true. The following taints are built in:
349+
The node controller automatically taints a Node when certain conditions
350+
are true. The following taints are built in:
349351

350352
* `node.kubernetes.io/not-ready`: Node is not ready. This corresponds to
351353
the NodeCondition `Ready` being "`False`".
@@ -385,7 +387,7 @@ controller can remove the relevant taint(s).
385387

386388
{{< note >}}
387389
<!--
388-
The control plane limits the rate of adding new taints to nodes. This rate limiting
390+
The control plane limits the rate of adding node new taints to nodes. This rate limiting
389391
manages the number of evictions that are triggered when many nodes become unreachable at
390392
once (for example: if there is a network disruption).
391393
-->
@@ -457,7 +459,8 @@ This ensures that DaemonSet pods are never evicted due to these problems.
457459
## Taint Nodes by Condition
458460

459461
The control plane, using the node {{<glossary_tooltip text="controller" term_id="controller">}},
460-
automatically creates taints with a `NoSchedule` effect for [node conditions](/docs/concepts/scheduling-eviction/node-pressure-eviction/#node-conditions).
462+
automatically creates taints with a `NoSchedule` effect for
463+
[node conditions](/docs/concepts/scheduling-eviction/node-pressure-eviction/#node-conditions).
461464
-->
462465
## 基于节点状态添加污点 {#taint-nodes-by-condition}
463466

@@ -496,9 +499,8 @@ onto the affected node.
496499
视为能够应对内存压力,而新创建的 `BestEffort` Pod 不会被调度到受影响的节点上。
497500

498501
<!--
499-
The DaemonSet controller automatically adds the
500-
following `NoSchedule` tolerations to all daemons, to prevent DaemonSets from
501-
breaking.
502+
The DaemonSet controller automatically adds the following `NoSchedule`
503+
tolerations to all daemons, to prevent DaemonSets from breaking.
502504

503505
* `node.kubernetes.io/memory-pressure`
504506
* `node.kubernetes.io/disk-pressure`
@@ -507,7 +509,7 @@ breaking.
507509
* `node.kubernetes.io/network-unavailable` (*host network only*)
508510
-->
509511

510-
DaemonSet 控制器自动为所有守护进程添加如下 `NoSchedule` 容忍度以防 DaemonSet 崩溃:
512+
DaemonSet 控制器自动为所有守护进程添加如下 `NoSchedule` 容忍度,以防 DaemonSet 崩溃:
511513

512514
* `node.kubernetes.io/memory-pressure`
513515
* `node.kubernetes.io/disk-pressure`
@@ -525,7 +527,8 @@ arbitrary tolerations to DaemonSets.
525527
## {{% heading "whatsnext" %}}
526528

527529
<!--
528-
* Read about [Node-pressure Eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/) and how you can configure it
530+
* Read about [Node-pressure Eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/)
531+
and how you can configure it
529532
* Read about [Pod Priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/)
530533
-->
531534
* 阅读[节点压力驱逐](/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction/),

0 commit comments

Comments
 (0)