在 CentOS 上部署的 Kubernetes(k8s)中,Pod 处于 Pending 状态通常表示:Pod 已经被 API Server 接收,但还没有被调度到某个节点上运行,或者调度了但起不来。常见原因和排查方法如下:
Pod 请求的 CPU 或内存超过节点可用资源。
排查:
kubectl describe pod <pod-name> -n <namespace>
看 Events 中是否有:
FailedScheduling ... Insufficient cpu / memory
解决:
requests/limitsCentOS 节点常见原因:
cordon排查:
kubectl get nodes
kubectl describe node <node-name>
常见现象:
STATUS ROLES VERSION AGE STATUS
NotReady
CentOS 特别注意:
df -h
systemctl status kubelet
journalctl -u kubelet -f
tainttolerations典型信息:
0/3 nodes are available: 3 node(s) had untolerated taint
解决:
kubectl taint nodes <node> key:NoSchedule-
如果是 Init:ImagePullBackOff 或 Pending + 拉镜像失败:
imagePullSecret排查:
kubectl describe pod <pod>
Pod 依赖 PVC,但 PV 不存在或不可用。
现象:
persistentvolumeclaim "xxx" not found
排查:
kubectl get pvc -n <ns>
kubectl get pv
排查:
kubectl get pods -n kube-system
kubectl get pod <pod> -o wide
kubectl describe pod <pod>
kubectl get events --sort-by=.metadata.creationTimestamp
| 问题 | 说明 |
|---|---|
| 防火墙 | firewalld 未关,导致节点通信失败 |
| SELinux | 未关闭导致 kubelet 异常 |
| 磁盘满 | /var/lib 满,Pod 无法启动 |
| swap 未关 | kubelet 启动失败 |
你可以直接贴出:
kubectl describe pod <pod>
kubectl get nodes
我可以帮你精准判断是哪一种原因。