policy
resource_error
ai_generated
true
Pod "my-pod" 因资源配额被驱逐:Pod 已被驱逐,因为其资源使用量超过了命名空间的配额
Pod "my-pod" evicted due to resource quota: the pod has been evicted because its resource usage exceeds the quota for the namespace
ID: policy/kubernetes-pod-eviction-resource-quota
85%修复率
88%置信度
1证据数
2024-01-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kubernetes v1.28 | active | — | — | — |
| Kubernetes v1.29 | active | — | — | — |
| kubelet v1.28.3 | active | — | — | — |
根因分析
Kubernetes ResourceQuota 对每个命名空间的总 CPU/内存实施限制;当累计使用量达到配额时,超过其请求/限制的 Pod 会触发驱逐。
English
Kubernetes ResourceQuota enforces limits on total CPU/memory per namespace; a pod exceeding its request/limit triggers eviction when cumulative usage hits the quota.
官方文档
https://kubernetes.io/docs/concepts/policy/resource-quotas/解决方案
-
检查当前命名空间配额使用情况:kubectl describe quota -n <namespace>。然后减少 Pod 资源请求/限制以适配可用配额,例如在部署 YAML 中设置 resources.requests.cpu: "250m" 和 resources.requests.memory: "256Mi"。
-
通过编辑增加命名空间 ResourceQuota:kubectl edit quota <quota-name> -n <namespace> 并提高 spec.hard.cpu 或 spec.hard.memory。
-
使用集群自动缩放或节点缩放添加更多资源,然后相应调整配额。
无效尝试
常见但无效的做法:
-
90% 失败
Simply restarting the pod without adjusting resource limits causes immediate re-eviction.
-
70% 失败
Increasing the pod's resource requests without checking namespace quota may still fail if the quota is already maxed out.
-
80% 失败
Deleting the ResourceQuota object to bypass limits can lead to resource starvation for other pods.