From 2bfdcc2a655e5c1e8bd95633972e123bced7846e Mon Sep 17 00:00:00 2001 From: windsonsea Date: Sat, 16 Jul 2022 19:05:40 +0800 Subject: [PATCH] [zh-cn] resync /concepts/scheduling-eviction/assign-pod-node.md --- .../scheduling-eviction/assign-pod-node.md | 61 +++++++++++++------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md b/content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md index c6d249d465..4eedc0c9ed 100644 --- a/content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md +++ b/content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md @@ -18,13 +18,13 @@ weight: 20 你可以约束一个 {{< glossary_tooltip text="Pod" term_id="pod" >}} @@ -172,6 +172,19 @@ define. Some of the benefits of affinity and anti-affinity include: * 你可以使用节点上(或其他拓扑域中)运行的其他 Pod 的标签来实施调度约束, 而不是只能使用节点本身的标签。这个能力让你能够定义规则允许哪些 Pod 可以被放置在一起。 + +亲和性功能由两种类型的亲和性组成: + +* **节点亲和性**功能类似于 `nodeSelector` 字段,但它的表达能力更强,并且允许你指定软规则。 +* Pod 间亲和性/反亲和性允许你根据其他 Pod 的标签来约束 Pod。 + 在这一示例中,所应用的规则如下: -* 节点必须包含键名为 `kubernetes.io/os` 的标签,并且其取值为 `linux`。 -* 节点 **最好** 具有键名为 `another-node-label-key` 且取值为 +* 节点**必须**包含一个键名为 `topology.kubernetes.io/zone` 的标签, + 并且该标签的取值**必须**为 `antarctica-east1` 或 `antarctica-west1`。 +* 节点**最好**具有一个键名为 `another-node-label-key` 且取值为 `another-node-label-value` 的标签。 如果你指定了多个与同一 `nodeSelectorTerms` 关联的 `matchExpressions`, 则只有当所有 `matchExpressions` 都满足时 Pod 才可以被调度到节点上。 @@ -341,8 +355,8 @@ must have existing nodes with the `kubernetes.io/os=linux` label. 在配置多个[调度方案](/zh-cn/docs/reference/scheduling/config/#multiple-profiles)时, @@ -410,7 +424,7 @@ Inter-pod affinity and anti-affinity allow you to constrain which nodes your Pods can be scheduled on based on the labels of **Pods** already running on that node, instead of the node labels. --> -### pod 间亲和性与反亲和性 {#inter-pod-affinity-and-anti-affinity} +### Pod 间亲和性与反亲和性 {#inter-pod-affinity-and-anti-affinity} Pod 间亲和性与反亲和性使你可以基于已经在节点上运行的 **Pod** 的标签来约束 Pod 可以调度到的节点,而不是基于节点上的标签。 @@ -552,9 +566,9 @@ same zone currently running Pods with the `Security=S2` Pod label. -查阅[设计文档](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/podaffinity.md) +查阅[设计文档](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md) 以进一步熟悉 Pod 亲和性与反亲和性的示例。 +以一个三节点的集群为例,该集群运行一个带有 Redis 这种内存缓存的 Web 应用程序。 +你可以使用节点间的亲和性和反亲和性来尽可能地将 Web 服务器与缓存并置。 + * 进一步阅读[污点与容忍度](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)文档。 -* 阅读[节点亲和性](https://git.k8s.io/community/contributors/design-proposals/scheduling/nodeaffinity.md) - 和[Pod 间亲和性与反亲和性](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md) +* 阅读[节点亲和性](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md) + 和[Pod 间亲和性与反亲和性](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md) 的设计文档。 * 了解[拓扑管理器](/zh-cn/docs/tasks/administer-cluster/topology-manager/)如何参与节点层面资源分配决定。 * 了解如何使用 [nodeSelector](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes/)。