Kubernetes InvalidVolume.ZoneMismatch尽管节点关联指定了可用区

f87krz0w  于 2023-06-21  发布在  Kubernetes
关注(0)|答案(1)|浏览(121)

作为gitlab CI/CD管道的一部分,应该在Kubernetes pod上调度和部署作业,该pod具有连接到其节点的EBS卷。EBS卷的单位为us-east-1c。我在runner-chart-values.yaml中指定了以下affinity部分:

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: topology.kubernetes.io/zone
          operator: In
          values:
          - us-east-1c

如这里所描述的,这意味着节点 * 必须 * 具有X1 M3 N1 X的可用性区域。我知道在相关的EKS集群中有一个节点的可用区为us-east-1c
当gitlab runner执行时,作业失败:

Warning  FailedAttachVolume  1s  attachdetach-controller  AttachVolume.Attach 
failed for volume "<volume-name>" : rpc error: code = Internal desc = Could not attach volume "<volume-id>" to node "<instance-id>": could not attach volume 
"<volume-id>" to node "<instance-id>": InvalidVolume.ZoneMismatch: The volume '<volume-id>' is not in 
the same availability zone as instance '<instance-id>'

怎么会这样?我已经验证了当作业运行时节点是可用的,但是即使不是这样,调度程序难道不会等到它可用(可能会超时),而不是使用错误可用区域中的节点吗?

jtw3ybtb

jtw3ybtb1#

我需要在配置文件的runners部分指定节点亲和性,以将需求应用于 job pod,而不是控制器pod:

config: |
    [[runners]]
      [runners.kubernetes]
        [runners.kubernetes.affinity]
          [runners.kubernetes.affinity.node_affinity]
            [runners.kubernetes.affinity.node_affinity.required_during_scheduling_ignored_during_execution]
              [[runners.kubernetes.affinity.node_affinity.required_during_scheduling_ignored_during_execution.node_selector_terms]]
                [[runners.kubernetes.affinity.node_affinity.required_during_scheduling_ignored_during_execution.node_selector_terms.match_expressions]]
                  key = "topology.kubernetes.io/zone"
                  operator = "In"
                  values = [
                    "us-east-1c"
                  ]

相关问题