@@ -231,7 +231,7 @@ For example, consider the following Pod spec:
231
231
你可以使用 Pod 规约中的 ` .spec.affinity.nodeAffinity ` 字段来设置节点亲和性。
232
232
例如,考虑下面的 Pod 规约:
233
233
234
- {{% code file="pods/pod-with-node-affinity.yaml" %}}
234
+ {{% code_sample file="pods/pod-with-node-affinity.yaml" %}}
235
235
236
236
<!--
237
237
In this example, the following rules apply:
@@ -331,7 +331,7 @@ For example, consider the following Pod spec:
331
331
332
332
例如,考虑下面的 Pod 规约:
333
333
334
- {{% code file="pods/pod-with-affinity-anti-affinity.yaml" %}}
334
+ {{% code_sample file="pods/pod-with-affinity-anti-affinity.yaml" %}}
335
335
336
336
<!--
337
337
If there are two possible nodes that match the
@@ -525,6 +525,24 @@ spec.
525
525
要使用 Pod 间亲和性,可以使用 Pod 规约中的 `.affinity.podAffinity` 字段。
526
526
对于 Pod 间反亲和性,可以使用 Pod 规约中的 `.affinity.podAntiAffinity` 字段。
527
527
528
+ <!--
529
+ # ### Scheduling a group of pods with inter-pod affinity to themselves
530
+
531
+ If the current Pod being scheduled is the first in a series that have affinity to themselves,
532
+ it is allowed to be scheduled if it passes all other affinity checks. This is determined by
533
+ verifying that no other pod in the cluster matches the namespace and selector of this pod,
534
+ that the pod matches its own terms, and the chosen node matches all requested topologies.
535
+ This ensures that there will not be a deadlock even if all the pods have inter-pod affinity
536
+ specified.
537
+ -->
538
+ # ### 调度一组具有 Pod 间亲和性的 Pod {#scheduling-a-group-of-pods-with-inter-pod-affinity-to-themselves}
539
+
540
+ 如果当前正被调度的 Pod 在具有自我亲和性的 Pod 序列中排在第一个,
541
+ 那么只要它满足其他所有的亲和性规则,它就可以被成功调度。
542
+ 这是通过以下方式确定的:确保集群中没有其他 Pod 与此 Pod 的命名空间和标签选择器匹配;
543
+ 该 Pod 满足其自身定义的条件,并且选定的节点满足所指定的所有拓扑要求。
544
+ 这确保即使所有的 Pod 都配置了 Pod 间亲和性,也不会出现调度死锁的情况。
545
+
528
546
<!--
529
547
# ### Pod affinity example {#an-example-of-a-pod-that-uses-pod-affinity}
530
548
@@ -534,7 +552,7 @@ Consider the following Pod spec:
534
552
535
553
考虑下面的 Pod 规约:
536
554
537
- {{% code file="pods/pod-with-pod-affinity.yaml" %}}
555
+ {{% code_sample file="pods/pod-with-pod-affinity.yaml" %}}
538
556
539
557
<!--
540
558
This example defines one Pod affinity rule and one Pod anti-affinity rule. The
0 commit comments