@@ -706,6 +706,18 @@ Kubernetes 在 Pod 亲和性或反亲和性中包含一个可选的 `matchLabelK
706
706
这些键用于从 Pod 的标签中查找值;这些键值标签与使用 `labelSelector` 字段定义的匹配限制组合(使用 `AND` 操作)。
707
707
这种组合的过滤机制选择将用于 Pod(反)亲和性计算的现有 Pod 集合。
708
708
709
+ {{< caution >}}
710
+ <!--
711
+ It's not recommended to use `matchLabelKeys` with labels that might be updated directly on pods.
712
+ Even if you edit the pod's label that is specified at `matchLabelKeys` **directly**, (that is, not via a deployment),
713
+ kube-apiserver doesn't reflect the label update onto the merged `labelSelector`.
714
+ -->
715
+ 不建议在 `matchLabelKeys` 中使用可能会直接在 Pod 上更新的标签。
716
+ 即使你编辑**直接**在 `matchLabelKeys` 中指定的 Pod 的标签
717
+ (也就是说,不是通过 Deployment 进行更新),
718
+ kube-apiserver 也不会将这种标签的更新反映到合并后的 `labelSelector` 上。
719
+ {{< /caution >}}
720
+
709
721
<!--
710
722
A common use case is to use `matchLabelKeys` with `pod-template-hash` (set on Pods
711
723
managed as part of a Deployment, where the value is unique for each revision).
@@ -769,13 +781,26 @@ When you want to disable it, you have to disable it explicitly via the
769
781
Kubernetes includes an optional `mismatchLabelKeys` field for Pod affinity
770
782
or anti-affinity. The field specifies keys for the labels that should **not** match with the incoming Pod's labels,
771
783
when satisfying the Pod (anti)affinity.
772
-
773
- One example use case is to ensure Pods go to the topology domain (node, zone, etc) where only Pods from the same tenant or team are scheduled in.
774
- In other words, you want to avoid running Pods from two different tenants on the same topology domain at the same time.
775
784
-->
776
785
Kubernetes 为 Pod 亲和性或反亲和性提供了一个可选的 `mismatchLabelKeys` 字段。
777
786
此字段指定了在满足 Pod(反)亲和性时,**不**应与传入 Pod 的标签匹配的键。
778
787
788
+ {{< caution >}}
789
+ <!--
790
+ It's not recommended to use `mismatchLabelKeys` with labels that might be updated directly on pods.
791
+ Even if you edit the pod's label that is specified at `mismatchLabelKeys` **directly**, (that is, not via a deployment),
792
+ kube-apiserver doesn't reflect the label update onto the merged `labelSelector`.
793
+ -->
794
+ 不建议在 `matchLabelKeys` 中使用可能会直接在 Pod 上更新的标签。
795
+ 即使你编辑**直接**在 `matchLabelKeys` 中指定的 Pod 的标签
796
+ (也就是说,不是通过 Deployment 进行更新),
797
+ kube-apiserver 也不会将这种标签的更新反映到合并后的 `labelSelector` 上。
798
+ {{< /caution >}}
799
+
800
+ <!--
801
+ One example use case is to ensure Pods go to the topology domain (node, zone, etc) where only Pods from the same tenant or team are scheduled in.
802
+ In other words, you want to avoid running Pods from two different tenants on the same topology domain at the same time.
803
+ -->
779
804
一个示例用例是确保 Pod 进入指定的拓扑域(节点、区域等),在此拓扑域中只调度来自同一租户或团队的 Pod。
780
805
换句话说,你想要避免在同一拓扑域中同时运行来自两个不同租户的 Pod。
781
806
0 commit comments