Skip to content

Pod Scheduling 失败

错误信息

                0/3 节点是 available: 3 节点(s) 有 taints 那个 pod didn't tolerate
              

快速摘要

scheduler cannot 位置 Pod on 任何节点 due 到 taints, resource 限制, affinity 规则, or 节点 selectors.

为什么发生

  • 节点 taints prevent Pod 从是 scheduled on available 节点

  • 节点 selector or 节点 affinity 规则做 不 match 任何节点

  • Pod anti-affinity 规则 prevent co-位置使用 existing Pods

  • Insufficient resources on 所有 matching 节点

最小示例

✗ 错误代码
spec:
  nodeSelector:
    disktype: ssd  # no nodes have this label
✓ 修复代码
spec:
  nodeSelector:
    disktype: ssd
  tolerations:
    - key: dedicated
      operator: Equal
      value: gpu
      effect: NoSchedule

Pod cannot 是 scheduled 因为否 节点 match selector or tolerate taints. fix 添加 tolerations.

如何诊断

  • 描述 Pod: kubectl 描述 pod <pod> — 检查事件小节

  • 检查节点 taints: kubectl 获取节点 -o 自定义-列=NAME:.metadata.name,TAINTS:.spec.taints

  • 验证 nodeSelector, affinity, and tolerations in Pod spec

  • 检查 available resources on 节点: kubectl 描述节点

如何修复

  • 添加 tolerations 到 Pod spec for 节点 taints

  • Adjust nodeSelector or affinity 规则到 match available 节点

  • 添加更多节点 or 移除 taints 从 existing 节点

  • Reduce resource 请求所以 Pod fits on available 节点

如何预防

  • Document 节点 taints and 必需 tolerations

  • 测试 Pod specs 针对 cluster constraints 之前 deploying

  • Monitor scheduling failures and alert on 它们

相关资源

相关术语

← 返回语言