简体   繁体   English

Kube.netes Pod Scheduling failed with 1 node(s) didn't match pod affinity/anti-affinity

[英]Kubernetes Pod Scheduling failed with 1 node(s) did not match pod affinity/anti-affinity

We have got a Kube.netes cluster up and running (with 1 master and 1 slave).我们已经启动并运行了一个 Kube.netes 集群(有 1 个主服务器和 1 个从服务器)。

Recently we added a new worker node (temp-worker) which was successful and all were on Cent OS 8最近我们添加了一个新的工作节点(temp-worker),它是成功的并且都在 Cent OS 8 上

Node Details节点详情

NAME            STATUS   ROLES                  AGE     VERSION
master-node     Ready    control-plane,master   34d     v1.20.2
temp-worker     Ready    <none>                 5h48m   v1.20.2
worker-node-2   Ready    worker                 34d     v1.20.0

I tried with the following pod specification (with 2 replicas), however pod remained in state Pending我尝试使用以下 pod 规范(有 2 个副本),但是 pod 仍处于 state Pending

Pod Spec Pod规格

   podAffinity:
     requiredDuringSchedulingIgnoredDuringExecution:
     - labelSelector:
         matchExpressions:
         - key: app                      #security
           operator: DoesNotExist
       topologyKey: kubernetes.io/hostname
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
            - key: app                      #security
              operator: In
              values:
              - hello-app
          topologyKey: kubernetes.io/hostname

Pod logs Pod 日志

Events:
  Type     Reason            Age    From               Message
  ----     ------            ----   ----               -------
  Warning  FailedScheduling  3m50s  default-scheduler  0/3 nodes are available: 1 node(s) didn't match pod affinity rules, 1 node(s) didn't match pod affinity/anti-affinity, 2 node(s) had volume node affinity conflict.
  Warning  FailedScheduling  3m50s  default-scheduler  0/3 nodes are available: 1 node(s) didn't match pod affinity rules, 1 node(s) didn't match pod affinity/anti-affinity, 2 node(s) had volume node affinity conflict.

I tried by changing the operator values (eg In, NotIn etc) in pod specification but nothing changed我尝试通过更改 pod 规范中的运算符值(例如 In、NotIn 等)但没有任何改变

I would like to understand why it reports error for the newly added worker-node.我想了解为什么它会报告新添加的工作节点的错误。 What did I do wrong?我做错了什么?

From this kube.netes doc “The Deployment controller stops the bad rollout automatically, and stops scaling up the new ReplicaSet.从这个 kube.netes 文档“部署 controller 自动停止错误的部署,并停止扩展新的 ReplicaSet。 This depends on the rollingUpdate parameters (maxUnavailable specifically) that you have specified.这取决于您指定的 rollingUpdate 参数(特别是 maxUnavailable)。 Kube.netes by default sets the value to 25%.” Kube.netes 默认将该值设置为 25%。”

Means that it prevents Kube.netes from evicting one pod out of three.这意味着它可以防止 Kube.netes 驱逐三个 pod 中的一个。 You are attempting a deployment update.您正在尝试部署更新。

Try adding the Max unavailable to deployment.尝试将不可用的 Max 添加到部署中。

strategy:
        type: RollingUpdate
        rollingUpdate:
          maxUnavailable: 1

As per this doc check whether all conditions are satisfied in your pod affinity.根据此文档,检查您的 pod 亲和力是否满足所有条件。

Try specifying the label values in the podAffinity, Maybe there are no matching nodes available in the that label values follow this doc for more information.尝试在 podAffinity 中指定 label 值,也许在 label 值中没有可用的匹配节点,请关注此文档以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes podAntiAffinity 影响部署 - FailedScheduling - 不匹配 pod 亲和性/反亲和性 - Kubernetes podAntiAffinity affects deployment - FailedScheduling - didn't match pod affinity/anti-affinity k8s 上的 Hashicorp 保管库:出现错误 1 memory 不足,1 个节点与 pod 亲和性/反亲和性不匹配 - Hashicorp vault on k8s: getting error 1 Insufficient memory, 1 node(s) didn't match pod affinity/anti-affinity Kube.netes Pod 反亲和性 - 基于 label 均匀分布 Pod? - Kubernetes Pod anti-affinity - evenly spread pods based on a label? kubernetes 亲和与反亲和 - kubernetes affinity & anti-affinity 如何确定以编程方式创建的 pod 的亲和力/反亲和力是什么? - How to determine what the affinity/anti-affinity of programmatically created pod are? 用于 Cronjob Pod 甚至调度的 K8s Pod Anti Affinity - K8s Pod Anti Affinity for Cronjob Pod Even Scheduling Kubernetes 中的会话反亲和性 - Session anti-affinity in Kubernetes Pod 反亲和性和重新平衡 Pod - Pod anti-affinity and re-balancing pods 由于反关联规则,升级到 Kubernetes 1.21 后 Pod 不再可部署 - Pod no longer deployable after upgrading to Kubernetes 1.21 due to anti-affinity rules Openshift Origin 1.5.1 Pod 对 DeploymentConfig 的反亲和性不起作用 - Openshift Origin 1.5.1 Pod anti-affinity on DeploymentConfig not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM