"); //-->
本文分享自天翼云开发者社区《kubelet报listen tcp [::1]:0: bind问题解决》,作者:SummerSnow
目录1.环境目录
2.问题现象
3.问题定位
4.问题解决
# k8s集群环境如下:[root@k8s-master][~] $ kubectl versionClient Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.0", GitCommit:"xxx", GitTreeState:"clean", BuildDate:"xxx", GoVersion:"go1.17.3", Compiler:"gc", Platform:"linux/amd64"} [root@k8s-master][~] $kubectl get nodeNAME STATUS ROLES AGE VERSIONk8s-master Ready control-plane,master 559d v1.23.0k8s-node1 Ready <none> 559d v1.23.0k8s-node2 Ready <none> 559d v1.23.0# 系统环境信息[root@k8s-master][~] $cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core)问题现象
#1 在master节点查看node节点信息的时候报NotReady[root@k8s-master][~] $kubectl get nodeNAME STATUS ROLES AGE VERSIONk8s-master Ready control-plane,master 559d v1.23.0k8s-node1 Ready <none> 559d v1.23.0k8s-node2 NotReady <none> 559d v1.23.0#2 登录k8s-node2,查看kubelet状态,处于restarting状态[root@k8s-node2][~] $systemctl status kubelet#3 查看日志,出现报错[root@k8s-node2][~] $journalctl -fu kubelet ......... Streaming server stopped unexpectedly" err="listen tcp [::1]:0: bind: cannot assign requested address .........问题定位
#1 初步判定 通过报错信息 [::1]:0: bind 可以判断回环地址有问题 #2 查看hosts配置信息,发现没配置本地解析信息[root@k8s-node2][~]$cat /etc/hosts xx.xx.xx.xx k8s-master xx.xx.xx.xx k8s-node1 xx.xx.xx.xx k8s-node2问题解决
#问题原因已找到,接下来就是解决问题#1 在hosts添加以下信息[root@k8s-node2][~] $vim /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6#2 重启kubelet[root@k8s-node2][~] $systemctl restart kubelet#3 查看kubelet状态,已经处于running[root@k8s-node2][~] $systemctl status kubelet#4 登录master节点查看node信息,已经变成ready了[root@k8s-master][~] $kubectl get nodeNAME STATUS ROLES AGE VERSIONk8s-master Ready control-plane,master 559d v1.23.0k8s-node1 Ready <none> 559d v1.23.0k8s-node2 Ready <none> 559d v1.23.0#5 查看是否还有异常pod,通过命令查看已经无异常pod了[root@k8s-master][~] $kubectl get pod -A |grep -v Running
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。