kubernetes runtime_error ai_generated true

0/4 个节点可用:4 个节点不匹配 Pod 的节点亲和性/选择器。抢占:0/4 个节点可用:4 个未找到可抢占的受害者。

0/4 nodes are available: 4 node(s) didn't match Pod's node affinity/selector. preemption: 0/4 nodes are available: 4 No preemption victims found for incoming pod.

ID: kubernetes/insufficient-node-selector

其他格式: JSON · Markdown 中文 · English
85%修复率
84%置信度
1证据数
2023-11-01首次发现

版本兼容性

版本状态引入弃用备注
Kubernetes 1.24 active
Kubernetes 1.27 active

根因分析

Pod 的节点亲和性规则或节点选择器与任何可用节点的标签都不匹配,并且抢占无法找到受害者,因为 Pod 的优先级太低或不存在更低优先级的 Pod。

English

The pod has node affinity rules or node selectors that do not match any available node's labels, and preemption cannot find victims because the pod's priority is too low or no lower-priority pods exist.

generic

官方文档

https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity

解决方案

  1. Check the pod's node affinity/selector: `kubectl get pod <pod-name> -o yaml | grep -A 10 nodeAffinity`. Then verify node labels: `kubectl get nodes --show-labels`. Adjust the pod spec or node labels to match.
  2. If the pod uses nodeSelector, add the required label to a node: `kubectl label node <node-name> <key>=<value>`. For example, if nodeSelector has `disktype: ssd`, run `kubectl label node worker1 disktype=ssd`.
  3. Remove or relax the node affinity rules by editing the pod/deployment spec: `kubectl edit deployment <deployment-name>` and remove the `nodeSelector` or `nodeAffinity` fields.

无效尝试

常见但无效的做法:

  1. 70% 失败

    Increasing the pod's priority class does not help if no nodes match the affinity rules; it only affects preemption.

  2. 80% 失败

    Adding more nodes without correct labels will not match the pod's selectors.