节点 Unavailable
错误信息
节点是 NotReady
快速摘要
节点 in cluster 是下 or 不 ready, reducing capacity and potentially causing Pod failures.
为什么发生
节点's kubelet 是不 运行 or 有 lost 连接到 API 服务器
节点有 运行 out 的 disk 空间 (evicted)
Hardware 失败 or network issues on 节点
节点是 cordoned or drained for maintenance
最小示例
✗ 错误代码
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
node-1 NotReady worker 30d v1.28.0✓ 修复代码
# SSH into node and restart kubelet
ssh node-1
sudo systemctl restart kubelet
# Verify
kubectl get nodes # node-1 should be Ready节点是 NotReady, likely 因为 kubelet 是不 运行. fix restarts kubelet on 节点.
如何诊断
检查节点状态:
kubectl 获取节点— look for NotReady描述节点:
kubectl 描述节点 <节点>for 事件 and 条件SSH 到节点 and 检查 kubelet:
systemctl 状态 kubelet检查节点 disk 空间:
df -hon 节点
如何修复
重启 kubelet on 节点:
systemctl 重启 kubeletFree 上 disk 空间 on 节点如果它 是完整
Reboot 节点如果它 是 in 坏状态
Uncordon 节点如果它 是 cordoned:
kubectl uncordon <节点>
如何预防
Monitor 节点 health and alert on NotReady 状态
设置 cluster autoscaling 到 replace unhealthy 节点
Regularly 检查 disk 空间 and clean 上旧 logs/镜像