@@ -45,17 +45,17 @@ Pod 被部署到哪个节点。例如,确保 Pod 最终落在连接了 SSD 的
45
45
You can use any of the following methods to choose where Kubernetes schedules
46
46
specific Pods:
47
47
48
- * [nodeSelector](#nodeselector) field matching against [node labels](#built-in-node-labels)
49
- * [Affinity and anti-affinity](#affinity-and-anti-affinity)
50
- * [nodeName](#nodename) field
51
- * [Pod topology spread constraints](#pod-topology-spread-constraints)
48
+ - [nodeSelector](#nodeselector) field matching against [node labels](#built-in-node-labels)
49
+ - [Affinity and anti-affinity](#affinity-and-anti-affinity)
50
+ - [nodeName](#nodename) field
51
+ - [Pod topology spread constraints](#pod-topology-spread-constraints)
52
52
-->
53
53
你可以使用下列方法中的任何一种来选择 Kubernetes 对特定 Pod 的调度:
54
54
55
- * 与[ 节点标签] ( #built-in-node-labels ) 匹配的 [ nodeSelector] ( #nodeSelector )
56
- * [ 亲和性与反亲和性] ( #affinity-and-anti-affinity )
57
- * [ nodeName] ( #nodename ) 字段
58
- * [ Pod 拓扑分布约束] ( #pod-topology-spread-constraints )
55
+ - 与[ 节点标签] ( #built-in-node-labels ) 匹配的 [ nodeSelector] ( #nodeSelector )
56
+ - [ 亲和性与反亲和性] ( #affinity-and-anti-affinity )
57
+ - [ nodeName] ( #nodename ) 字段
58
+ - [ Pod 拓扑分布约束] ( #pod-topology-spread-constraints )
59
59
60
60
<!--
61
61
## Node labels {#built-in-node-labels}
@@ -162,33 +162,33 @@ define. Some of the benefits of affinity and anti-affinity include:
162
162
亲和性和反亲和性扩展了你可以定义的约束类型。使用亲和性与反亲和性的一些好处有:
163
163
164
164
<!--
165
- * The affinity/anti-affinity language is more expressive. `nodeSelector` only
165
+ - The affinity/anti-affinity language is more expressive. `nodeSelector` only
166
166
selects nodes with all the specified labels. Affinity/anti-affinity gives you
167
167
more control over the selection logic.
168
- * You can indicate that a rule is *soft* or *preferred*, so that the scheduler
168
+ - You can indicate that a rule is *soft* or *preferred*, so that the scheduler
169
169
still schedules the Pod even if it can't find a matching node.
170
- * You can constrain a Pod using labels on other Pods running on the node (or other topological domain),
170
+ - You can constrain a Pod using labels on other Pods running on the node (or other topological domain),
171
171
instead of just node labels, which allows you to define rules for which Pods
172
172
can be co-located on a node.
173
173
-->
174
- * 亲和性、反亲和性语言的表达能力更强。` nodeSelector ` 只能选择拥有所有指定标签的节点。
174
+ - 亲和性、反亲和性语言的表达能力更强。` nodeSelector ` 只能选择拥有所有指定标签的节点。
175
175
亲和性、反亲和性为你提供对选择逻辑的更强控制能力。
176
- * 你可以标明某规则是“软需求”或者“偏好”,这样调度器在无法找到匹配节点时仍然调度该 Pod。
177
- * 你可以使用节点上(或其他拓扑域中)运行的其他 Pod 的标签来实施调度约束,
176
+ - 你可以标明某规则是“软需求”或者“偏好”,这样调度器在无法找到匹配节点时仍然调度该 Pod。
177
+ - 你可以使用节点上(或其他拓扑域中)运行的其他 Pod 的标签来实施调度约束,
178
178
而不是只能使用节点本身的标签。这个能力让你能够定义规则允许哪些 Pod 可以被放置在一起。
179
179
180
180
<!--
181
181
The affinity feature consists of two types of affinity:
182
182
183
- * *Node affinity* functions like the `nodeSelector` field but is more expressive and
183
+ - *Node affinity* functions like the `nodeSelector` field but is more expressive and
184
184
allows you to specify soft rules.
185
- * *Inter-pod affinity/anti-affinity* allows you to constrain Pods against labels
185
+ - *Inter-pod affinity/anti-affinity* allows you to constrain Pods against labels
186
186
on other Pods.
187
187
-->
188
188
亲和性功能由两种类型的亲和性组成:
189
189
190
- * ** 节点亲和性** 功能类似于 ` nodeSelector ` 字段,但它的表达能力更强,并且允许你指定软规则。
191
- * Pod 间亲和性/反亲和性允许你根据其他 Pod 的标签来约束 Pod。
190
+ - ** 节点亲和性** 功能类似于 ` nodeSelector ` 字段,但它的表达能力更强,并且允许你指定软规则。
191
+ - Pod 间亲和性/反亲和性允许你根据其他 Pod 的标签来约束 Pod。
192
192
193
193
<!--
194
194
### Node affinity
@@ -204,17 +204,17 @@ affinity:
204
204
节点亲和性有两种:
205
205
206
206
<!--
207
- * `requiredDuringSchedulingIgnoredDuringExecution`: The scheduler can't
207
+ - `requiredDuringSchedulingIgnoredDuringExecution`: The scheduler can't
208
208
schedule the Pod unless the rule is met. This functions like `nodeSelector`,
209
209
but with a more expressive syntax.
210
- * `preferredDuringSchedulingIgnoredDuringExecution`: The scheduler tries to
210
+ - `preferredDuringSchedulingIgnoredDuringExecution`: The scheduler tries to
211
211
find a node that meets the rule. If a matching node is not available, the
212
212
scheduler still schedules the Pod.
213
213
-->
214
- * ` requiredDuringSchedulingIgnoredDuringExecution ` :
214
+ - ` requiredDuringSchedulingIgnoredDuringExecution ` :
215
215
调度器只有在规则被满足的时候才能执行调度。此功能类似于 ` nodeSelector ` ,
216
216
但其语法表达能力更强。
217
- * ` preferredDuringSchedulingIgnoredDuringExecution ` :
217
+ - ` preferredDuringSchedulingIgnoredDuringExecution ` :
218
218
调度器会尝试寻找满足对应规则的节点。如果找不到匹配的节点,调度器仍然会调度该 Pod。
219
219
220
220
{{<note >}}
@@ -240,16 +240,16 @@ For example, consider the following Pod spec:
240
240
<!--
241
241
In this example, the following rules apply:
242
242
243
- * The node *must* have a label with the key `topology.kubernetes.io/zone` and
243
+ - The node *must* have a label with the key `topology.kubernetes.io/zone` and
244
244
the value of that label *must* be either `antarctica-east1` or `antarctica-west1`.
245
- * The node *preferably* has a label with the key `another-node-label-key` and
245
+ - The node *preferably* has a label with the key `another-node-label-key` and
246
246
the value `another-node-label-value`.
247
247
-->
248
248
在这一示例中,所应用的规则如下:
249
249
250
- * 节点** 必须** 包含一个键名为 ` topology.kubernetes.io/zone ` 的标签,
250
+ - 节点** 必须** 包含一个键名为 ` topology.kubernetes.io/zone ` 的标签,
251
251
并且该标签的取值** 必须** 为 ` antarctica-east1 ` 或 ` antarctica-west1 ` 。
252
- * 节点** 最好** 具有一个键名为 ` another-node-label-key ` 且取值为
252
+ - 节点** 最好** 具有一个键名为 ` another-node-label-key ` 且取值为
253
253
` another-node-label-value ` 的标签。
254
254
255
255
<!--
@@ -499,8 +499,8 @@ anti-affinity as follows:
499
499
500
500
与[节点亲和性](#node-affinity)类似,Pod 的亲和性与反亲和性也有两种类型:
501
501
502
- * `requiredDuringSchedulingIgnoredDuringExecution`
503
- * `preferredDuringSchedulingIgnoredDuringExecution`
502
+ - ` requiredDuringSchedulingIgnoredDuringExecution`
503
+ - ` preferredDuringSchedulingIgnoredDuringExecution`
504
504
505
505
<!--
506
506
For example, you could use
@@ -590,17 +590,17 @@ exceptions for performance and security reasons:
590
590
有一些限制:
591
591
592
592
<!--
593
- * For Pod affinity and anti-affinity, an empty `topologyKey` field is not allowed in both `requiredDuringSchedulingIgnoredDuringExecution`
593
+ - For Pod affinity and anti-affinity, an empty `topologyKey` field is not allowed in both `requiredDuringSchedulingIgnoredDuringExecution`
594
594
and `preferredDuringSchedulingIgnoredDuringExecution`.
595
- * For `requiredDuringSchedulingIgnoredDuringExecution` Pod anti-affinity rules,
595
+ - For `requiredDuringSchedulingIgnoredDuringExecution` Pod anti-affinity rules,
596
596
the admission controller `LimitPodHardAntiAffinityTopology` limits
597
597
` topologyKey` to `kubernetes.io/hostname`. You can modify or disable the
598
598
admission controller if you want to allow custom topologies.
599
599
-->
600
- * 对于 Pod 亲和性而言,在 `requiredDuringSchedulingIgnoredDuringExecution`
600
+ - 对于 Pod 亲和性而言,在 `requiredDuringSchedulingIgnoredDuringExecution`
601
601
和 `preferredDuringSchedulingIgnoredDuringExecution` 中,`topologyKey`
602
602
不允许为空。
603
- * 对于 `requiredDuringSchedulingIgnoredDuringExecution` 要求的 Pod 反亲和性,
603
+ - 对于 `requiredDuringSchedulingIgnoredDuringExecution` 要求的 Pod 反亲和性,
604
604
准入控制器 `LimitPodHardAntiAffinityTopology` 要求 `topologyKey` 只能是
605
605
` kubernetes.io/hostname` 。如果你希望使用其他定制拓扑逻辑,
606
606
你可以更改准入控制器或者禁用之。
@@ -758,10 +758,10 @@ where each web server is co-located with a cache, on three separate nodes.
758
758
创建前面两个 Deployment 会产生如下的集群布局,每个 Web 服务器与一个缓存实例并置,
759
759
并分别运行在三个独立的节点上。
760
760
761
- | node-1 | node-2 | node-3 |
762
- |:-------------------- :|:------------------- :|:----- -------------:|
763
- | *webserver-1* | *webserver-2* | *webserver-3* |
764
- | *cache-1* | *cache-2* | *cache-3* |
761
+ | node-1 | node-2 | node-3 |
762
+ |:-------------:|:-------------:|:-------------:|
763
+ | *webserver-1* | *webserver-2* | *webserver-3* |
764
+ | *cache-1* | *cache-2* | *cache-3* |
765
765
766
766
<!--
767
767
The overall effect is that each cache instance is likely to be accessed by a single client, that
@@ -872,18 +872,18 @@ to learn more about how these work.
872
872
# # {{% heading "whatsnext" %}}
873
873
874
874
<!--
875
- * Read more about [taints and tolerations](/docs/concepts/scheduling-eviction/taint-and-toleration/) .
876
- * Read the design docs for [node affinity](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md)
875
+ - Read more about [taints and tolerations](/docs/concepts/scheduling-eviction/taint-and-toleration/) .
876
+ - Read the design docs for [node affinity](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md)
877
877
and for [inter-pod affinity/anti-affinity](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md).
878
- * Learn about how the [topology manager](/docs/tasks/administer-cluster/topology-manager/) takes part in node-level
878
+ - Learn about how the [topology manager](/docs/tasks/administer-cluster/topology-manager/) takes part in node-level
879
879
resource allocation decisions.
880
- * Learn how to use [nodeSelector](/docs/tasks/configure-pod-container/assign-pods-nodes/).
881
- * Learn how to use [affinity and anti-affinity](/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/).
880
+ - Learn how to use [nodeSelector](/docs/tasks/configure-pod-container/assign-pods-nodes/).
881
+ - Learn how to use [affinity and anti-affinity](/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/).
882
882
-->
883
- * 进一步阅读[污点与容忍度](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)文档。
884
- * 阅读[节点亲和性](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md)
883
+ - 进一步阅读[污点与容忍度](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)文档。
884
+ - 阅读[节点亲和性](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md)
885
885
和[Pod 间亲和性与反亲和性](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md)
886
886
的设计文档。
887
- * 了解[拓扑管理器](/zh-cn/docs/tasks/administer-cluster/topology-manager/)如何参与节点层面资源分配决定。
888
- * 了解如何使用 [nodeSelector](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes/)。
887
+ - 了解[拓扑管理器](/zh-cn/docs/tasks/administer-cluster/topology-manager/)如何参与节点层面资源分配决定。
888
+ - 了解如何使用 [nodeSelector](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes/)。
889
889
* 了解如何使用[亲和性和反亲和性](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/)。
0 commit comments