@@ -87,7 +87,7 @@ Pod 拓扑分布约束使你能够以声明的方式进行配置。
87
87
The Pod API includes a field, `spec.topologySpreadConstraints`. The usage of this field looks like
88
88
the following:
89
89
-->
90
- ## ` topologySpreadConstraints ` 字段
90
+ ## ` topologySpreadConstraints ` 字段 {#topologyspreadconstraints-field}
91
91
92
92
Pod API 包括一个 ` spec.topologySpreadConstraints ` 字段。这个字段的用法如下所示:
93
93
@@ -126,7 +126,7 @@ You can define one or multiple `topologySpreadConstraints` entries to instruct t
126
126
kube-scheduler how to place each incoming Pod in relation to the existing Pods across
127
127
your cluster. Those fields are:
128
128
-->
129
- ### 分布约束定义
129
+ ### 分布约束定义 {#spread-constraint-definition}
130
130
131
131
你可以定义一个或多个 ` topologySpreadConstraints ` 条目以指导 kube-scheduler
132
132
如何将每个新来的 Pod 与跨集群的现有 Pod 相关联。这些字段包括:
@@ -328,13 +328,15 @@ For example, a node might have labels:
328
328
-->
329
329
# ## 节点标签 {#node-labels}
330
330
331
- 拓扑分布约束依赖于节点标签来标识每个{{< glossary_tooltip text="节点" term_id="node" >}}所在的拓扑域。例如,某节点可能具有标签:
331
+ 拓扑分布约束依赖于节点标签来标识每个{{< glossary_tooltip text="节点" term_id="node" >}}所在的拓扑域。
332
+ 例如,某节点可能具有标签:
332
333
333
334
` ` ` yaml
334
335
region: us-east-1
335
336
zone: us-east-1a
336
337
` ` `
337
338
339
+ {{< note >}}
338
340
<!--
339
341
For brevity, this example doesn't use the
340
342
[well-known](/docs/reference/labels-annotations-taints/) label keys
@@ -345,7 +347,6 @@ those registered label keys are nonetheless recommended rather than the private
345
347
You can't make a reliable assumption about the meaning of a private label key
346
348
between different contexts.
347
349
-->
348
- {{< note >}}
349
350
为了简便,此示例未使用[众所周知](/zh-cn/docs/reference/labels-annotations-taints/)的标签键
350
351
` topology.kubernetes.io/zone` 和 `topology.kubernetes.io/region`。
351
352
但是,建议使用那些已注册的标签键,而不是此处使用的私有(不合格)标签键 `region` 和 `zone`。
@@ -762,7 +763,7 @@ topology spread constraints are applied to a Pod if, and only if:
762
763
763
764
Default constraints can be set as part of the `PodTopologySpread` plugin
764
765
arguments in a [scheduling profile](/docs/reference/scheduling/config/#profiles).
765
- The constraints are specified with the same [API above](#api ), except that
766
+ The constraints are specified with the same [API above](#topologyspreadconstraints-field ), except that
766
767
`labelSelector` must be empty. The selectors are calculated from the Services,
767
768
ReplicaSets, StatefulSets or ReplicationControllers that the Pod belongs to.
768
769
@@ -776,7 +777,7 @@ An example configuration might look like follows:
776
777
- Pod 隶属于某个 Service、ReplicaSet、StatefulSet 或 ReplicationController。
777
778
778
779
默认约束可以设置为[调度方案](/zh-cn/docs/reference/scheduling/config/#profiles)中
779
- `PodTopologySpread` 插件参数的一部分。约束的设置采用[如前所述的 API](#api ),
780
+ `PodTopologySpread` 插件参数的一部分。约束的设置采用[如前所述的 API](#topologyspreadconstraints-field ),
780
781
只是 `labelSelector` 必须为空。
781
782
选择算符是根据 Pod 所属的 Service、ReplicaSet、StatefulSet 或 ReplicationController 来设置的。
782
783
@@ -798,12 +799,12 @@ profiles:
798
799
defaultingType: List
799
800
```
800
801
802
+ {{< note >}}
801
803
<!--
802
804
The [`SelectorSpread` plugin](/docs/reference/scheduling/config/#scheduling-plugins)
803
805
is disabled by default. The Kubernetes project recommends using `PodTopologySpread`
804
806
to achieve similar behavior.
805
807
-->
806
- {{< note >}}
807
808
默认配置下,[ ` SelectorSpread ` 插件] ( /zh-cn/docs/reference/scheduling/config/#scheduling-plugins ) 是被禁用的。
808
809
Kubernetes 项目建议使用 ` PodTopologySpread ` 以执行类似行为。
809
810
{{< /note >}}
@@ -838,6 +839,7 @@ is disabled by default.
838
839
-->
839
840
此外,原来用于提供等同行为的 `SelectorSpread` 插件默认被禁用。
840
841
842
+ {{< note >}}
841
843
<!--
842
844
The `PodTopologySpread` plugin does not score the nodes that don't have
843
845
the topology keys specified in the spreading constraints. This might result
@@ -848,7 +850,6 @@ If your nodes are not expected to have **both** `kubernetes.io/hostname` and
848
850
` topology.kubernetes.io/zone` labels set, define your own constraints
849
851
instead of using the Kubernetes defaults.
850
852
-->
851
- {{< note >}}
852
853
对于分布约束中所指定的拓扑键而言,`PodTopologySpread` 插件不会为不包含这些拓扑键的节点评分。
853
854
这可能导致在使用默认拓扑约束时,其行为与原来的 `SelectorSpread` 插件的默认行为不同。
854
855
@@ -898,6 +899,7 @@ or more scattered.
898
899
在 Kubernetes 中,Pod 间亲和性和反亲和性控制 Pod 彼此的调度方式(更密集或更分散)。
899
900
900
901
对于 `podAffinity`:吸引 Pod;你可以尝试将任意数量的 Pod 集中到符合条件的拓扑域中。
902
+
901
903
对于 `podAntiAffinity`:驱逐 Pod。如果将此设为 `requiredDuringSchedulingIgnoredDuringExecution` 模式,
902
904
则只有单个 Pod 可以调度到单个拓扑域;如果你选择 `preferredDuringSchedulingIgnoredDuringExecution`,
903
905
则你将丢失强制执行此约束的能力。
@@ -967,5 +969,5 @@ section of the enhancement proposal about Pod topology spread constraints.
967
969
-->
968
970
- 博客:[PodTopologySpread 介绍](/blog/2020/05/introducing-podtopologyspread/)详细解释了 `maxSkew`,
969
971
并给出了一些进阶的使用示例。
970
- - 阅读针对 Pod 的 API 参考的
971
- [调度](/zh-cn/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)一节。
972
+ - 阅读针对 Pod 的 API
973
+ 参考的 [调度](/zh-cn/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling)一节。
0 commit comments