日期: April 17, 2022
一次偶然发现,测试环境出现ep消失的现象
首先发现了nodeport外部已经无法访问,于是嘗試 kubectl get ep,发现svc和pod没有绑定,但状态不是
下一步 Kubectl describe ep xxx 发现异常字段
notReadyAddresses
Kube describe pod xxx 发现
Pod status 字段为 ready false
但我的Pod明明是正常状态,既没有检查检查失败也没有报错重启,于是查了一下这个现象
原来endpoint是根据pod的status中的conditions中type是Ready的字典中的status是否为True进行判断
而Pod status字段又是由kube-controller-manager进行更新为False
kubelet负责收集节点信息进行上报,默认是10秒上报一次
kube-controller-manager判断node上报心跳超时的时间为40秒
所以有可能是kubelet 上报失败超时
最终重启了kubelet ep恢复正常(所以为什么说重启是神)
或者可以调整kube-controller-manager 配置参数,延长超时时间(不建议)
node-monitor-grace-period