写点什么

kubelet 报 listen tcp [::1]:0: bind 问题解决

  • 2025-08-15
    北京
  • 本文字数:1232 字

    阅读完需:约 4 分钟

本文分享自天翼云开发者社区《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-masterxx.xx.xx.xx k8s-node1xx.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
复制代码


用户头像

还未添加个人签名 2022-02-22 加入

天翼云是中国电信倾力打造的云服务品牌,致力于成为领先的云计算服务提供商。提供云主机、CDN、云电脑、大数据及AI等全线产品和场景化解决方案。

评论

发布
暂无评论
kubelet报listen tcp [::1]:0: bind问题解决_容器_天翼云开发者社区_InfoQ写作社区