Skip to content

Commit b89bec5

Browse files
authored
Merge pull request #43403 from windsonsea/tolyh
[zh] Sync taint-and-toleration and topology-spread-constraints
2 parents 1b56dc5 + 39d9d0a commit b89bec5

File tree

2 files changed

+84
-37
lines changed

2 files changed

+84
-37
lines changed

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

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,51 @@ An empty `effect` matches all effects with key `key1`.
142142

143143
<!--
144144
The above example used `effect` of `NoSchedule`. Alternatively, you can use `effect` of `PreferNoSchedule`.
145-
This is a "preference" or "soft" version of `NoSchedule` -- the system will *try* to avoid placing a
146-
pod that does not tolerate the taint on the node, but it is not required. The third kind of `effect` is
147-
`NoExecute`, described later.
148145
-->
149146
上述例子中 `effect` 使用的值为 `NoSchedule`,你也可以使用另外一个值 `PreferNoSchedule`。
150-
这是“优化”或“软”版本的 `NoSchedule` —— 系统会 **尽量** 避免将 Pod 调度到存在其不能容忍污点的节点上,
151-
但这不是强制的。`effect` 的值还可以设置为 `NoExecute`,下文会详细描述这个值。
147+
148+
<!--
149+
The allowed values for the `effect` field are:
150+
-->
151+
`effect` 字段的允许值包括:
152+
153+
<!--
154+
`NoExecute`
155+
: This affects pods that are already running on the node as follows:
156+
* Pods that do not tolerate the taint are evicted immediately
157+
* Pods that tolerate the taint without specifying `tolerationSeconds` in
158+
their toleration specification remain bound forever
159+
* Pods that tolerate the taint with a specified `tolerationSeconds` remain
160+
bound for the specified amount of time. After that time elapses, the node
161+
lifecycle controller evicts the Pods from the node.
162+
-->
163+
`NoExecute`
164+
: 这会影响已在节点上运行的 Pod,具体影响如下:
165+
* 如果 Pod 不能容忍这类污点,会马上被驱逐。
166+
* 如果 Pod 能够容忍这类污点,但是在容忍度定义中没有指定 `tolerationSeconds`,
167+
则 Pod 还会一直在这个节点上运行。
168+
* 如果 Pod 能够容忍这类污点,而且指定了 `tolerationSeconds`,
169+
则 Pod 还能在这个节点上继续运行这个指定的时间长度。
170+
这段时间过去后,节点生命周期控制器从节点驱除这些 Pod。
171+
172+
<!--
173+
`NoSchedule`
174+
: No new Pods will be scheduled on the tainted node unless they have a matching
175+
toleration. Pods currently running on the node are **not** evicted.
176+
-->
177+
`NoSchedule`
178+
: 除非具有匹配的容忍度规约,否则新的 Pod 不会被调度到带有污点的节点上。
179+
当前正在节点上运行的 Pod **不会**被驱逐。
180+
181+
<!--
182+
`PreferNoSchedule`
183+
: `PreferNoSchedule` is a "preference" or "soft" version of `NoSchedule`.
184+
The control plane will *try* to avoid placing a Pod that does not tolerate
185+
the taint on the node, but it is not guaranteed.
186+
-->
187+
`PreferNoSchedule`
188+
: `PreferNoSchedule` 是“偏好”或“软性”的 `NoSchedule`。
189+
控制平面将**尝试**避免将不能容忍污点的 Pod 调度到的节点上,但不能保证完全避免。
152190

153191
<!--
154192
You can put multiple taints on the same node and multiple tolerations on the same pod.
@@ -225,7 +263,7 @@ an optional `tolerationSeconds` field that dictates how long the pod will stay b
225263
to the node after the taint is added. For example,
226264
-->
227265
通常情况下,如果给一个节点添加了一个 effect 值为 `NoExecute` 的污点,
228-
则任何不能忍受这个污点的 Pod 都会马上被驱逐,任何可以忍受这个污点的 Pod 都不会被驱逐。
266+
则任何不能容忍这个污点的 Pod 都会马上被驱逐,任何可以容忍这个污点的 Pod 都不会被驱逐。
229267
但是,如果 Pod 存在一个 effect 值为 `NoExecute` 的容忍度指定了可选属性
230268
`tolerationSeconds` 的值,则表示在给节点添加了上述污点之后,
231269
Pod 还能继续在节点上运行的时间。例如,
@@ -327,7 +365,7 @@ manually add tolerations to your pods.
327365
* **Taint based Evictions**: A per-pod-configurable eviction behavior
328366
when there are node problems, which is described in the next section.
329367
-->
330-
* **基于污点的驱逐**: 这是在每个 Pod 中配置的在节点出现问题时的驱逐行为,
368+
* **基于污点的驱逐**这是在每个 Pod 中配置的在节点出现问题时的驱逐行为,
331369
接下来的章节会描述这个特性。
332370

333371
<!--
@@ -337,24 +375,6 @@ when there are node problems, which is described in the next section.
337375

338376
{{< feature-state for_k8s_version="v1.18" state="stable" >}}
339377

340-
<!--
341-
The `NoExecute` taint effect, mentioned above, affects pods that are already
342-
running on the node as follows
343-
344-
* pods that do not tolerate the taint are evicted immediately
345-
* pods that tolerate the taint without specifying `tolerationSeconds` in
346-
their toleration specification remain bound forever
347-
* pods that tolerate the taint with a specified `tolerationSeconds` remain
348-
bound for the specified amount of time
349-
-->
350-
前文提到过污点的效果值 `NoExecute` 会影响已经在节点上运行的如下 Pod:
351-
352-
* 如果 Pod 不能忍受这类污点,Pod 会马上被驱逐。
353-
* 如果 Pod 能够忍受这类污点,但是在容忍度定义中没有指定 `tolerationSeconds`,
354-
则 Pod 还会一直在这个节点上运行。
355-
* 如果 Pod 能够忍受这类污点,而且指定了 `tolerationSeconds`,
356-
则 Pod 还能在这个节点上继续运行这个指定的时间长度。
357-
358378
<!--
359379
The node controller automatically taints a Node when certain conditions
360380
are true. The following taints are built in:
@@ -380,19 +400,22 @@ are true. The following taints are built in:
380400
的值为 "`Unknown`"。
381401
* `node.kubernetes.io/memory-pressure`:节点存在内存压力。
382402
* `node.kubernetes.io/disk-pressure`:节点存在磁盘压力。
383-
* `node.kubernetes.io/pid-pressure`: 节点的 PID 压力。
403+
* `node.kubernetes.io/pid-pressure`节点的 PID 压力。
384404
* `node.kubernetes.io/network-unavailable`:节点网络不可用。
385-
* `node.kubernetes.io/unschedulable`: 节点不可调度。
405+
* `node.kubernetes.io/unschedulable`节点不可调度。
386406
* `node.cloudprovider.kubernetes.io/uninitialized`:如果 kubelet 启动时指定了一个“外部”云平台驱动,
387407
它将给当前节点添加一个污点将其标志为不可用。在 cloud-controller-manager
388408
的一个控制器初始化这个节点后,kubelet 将删除这个污点。
389409

390410
<!--
391411
In case a node is to be drained, the node controller or the kubelet adds relevant taints
392-
with `NoExecute` effect. If the fault condition returns to normal the kubelet or node
412+
with `NoExecute` effect. This effect is added by default for the
413+
`node.kubernetes.io/not-ready` and `node.kubernetes.io/unreachable` taints.
414+
If the fault condition returns to normal, the kubelet or node
393415
controller can remove the relevant taint(s).
394416
-->
395417
在节点被排空时,节点控制器或者 kubelet 会添加带有 `NoExecute` 效果的相关污点。
418+
此效果被默认添加到 `node.kubernetes.io/not-ready` 和 `node.kubernetes.io/unreachable` 污点中。
396419
如果异常状态恢复正常,kubelet 或节点控制器能够移除相关的污点。
397420

398421
<!--
@@ -532,9 +555,9 @@ DaemonSet 控制器自动为所有守护进程添加如下 `NoSchedule` 容忍
532555

533556
* `node.kubernetes.io/memory-pressure`
534557
* `node.kubernetes.io/disk-pressure`
535-
* `node.kubernetes.io/pid-pressure` (1.14 或更高版本)
536-
* `node.kubernetes.io/unschedulable` (1.10 或更高版本)
537-
* `node.kubernetes.io/network-unavailable` (**只适合主机网络配置**)
558+
* `node.kubernetes.io/pid-pressure`1.14 或更高版本
559+
* `node.kubernetes.io/unschedulable`1.10 或更高版本
560+
* `node.kubernetes.io/network-unavailable`**只适合主机网络配置**
538561

539562
<!--
540563
Adding these tolerations ensures backward compatibility. You can also add

content/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Pod 拓扑分布约束
33
content_type: concept
44
weight: 40
55
---
6-
76
<!--
87
title: Pod Topology Spread Constraints
98
content_type: concept
@@ -91,6 +90,27 @@ the following:
9190

9291
Pod API 包括一个 `spec.topologySpreadConstraints` 字段。这个字段的用法如下所示:
9392

93+
<!--
94+
```yaml
95+
---
96+
apiVersion: v1
97+
kind: Pod
98+
metadata:
99+
name: example-pod
100+
spec:
101+
# Configure a topology spread constraint
102+
topologySpreadConstraints:
103+
- maxSkew: <integer>
104+
minDomains: <integer> # optional; beta since v1.25
105+
topologyKey: <string>
106+
whenUnsatisfiable: <string>
107+
labelSelector: <object>
108+
matchLabelKeys: <list> # optional; beta since v1.27
109+
nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26
110+
nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26
111+
### other Pod fields go here
112+
```
113+
-->
94114
```yaml
95115
---
96116
apiVersion: v1
@@ -164,12 +184,16 @@ your cluster. Those fields are:
164184

165185
{{< note >}}
166186
<!--
167-
The `minDomains` field is a beta field and disabled by default in 1.25. You can enable it by enabling the
168-
`MinDomainsInPodTopologySpread` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/).
187+
The `MinDomainsInPodTopologySpread` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
188+
enables `minDomains` for pod topology spread. Starting from v1.28,
189+
the `MinDomainsInPodTopologySpread` gate
190+
is enabled by default. In older Kubernetes clusters it might be explicitly
191+
disabled or the field might not be available.
169192
-->
170-
`minDomains` 字段是一个 Beta 字段,在 1.25 中默认被禁用。
171-
你可以通过启用 `MinDomainsInPodTopologySpread`
172-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)来启用该字段。
193+
`MinDomainsInPodTopologySpread`
194+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
195+
Pod 拓扑分布启用 `minDomains`。自 v1.28 起,`MinDomainsInPodTopologySpread` 特性门控默认被启用。
196+
在早期的 Kubernetes 集群中,此特性门控可能被显式禁用或此字段可能不可用。
173197
{{< /note >}}
174198

175199
<!--

0 commit comments

Comments
 (0)