请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

kubectl get node 偶尔会报错

图片描述
老师
kubectl get node 和 kubectl get po -n kube-system 有时候能正常访问,如上图,有时候就是提示
“The connection to the server 192.168.56.101:6443 was refused - did you specify the right host or port?”错误,
查看kube日志有时候是上述:
error getting node “master”: Get “https://192.168.56.101:6443/api/v1/nodes/master?timeout=10s”: dial tcp 192.168.56.101:6443: connect: connection refused
有时候 是如下图
图片描述
老师,这样该怎么去排查问题?

正在回答 回答被采纳积分+3

插入代码

1回答

清风 2022-07-28 19:35:22

看你的kube-system 的pod是否都起来了

0 回复 有任何疑惑可以回复我~
  • 提问者 酷乐虎 #1
    全部起起来了,就是间歇性的出现错误,执行kubectl get po -n kube-system能显示所有的pod都是running,要么“The connection to the server 192.168.56.101:6443 was refused - did you specify the right host or port?”我截的第一张图最下面有全部的状态.
    比如说,我连着执行kubectl get po -n kube-system 10次,会有几次出现The connection to the server 192.168.56.101:6443 was refused - did you specify the right host or port?
    回复 有任何疑惑可以回复我~ 2022-07-28 20:13:50
  • 清风 回复 提问者 酷乐虎 #2
    这一般是coredns解析域名报错,可以看看这个pod日志
    回复 有任何疑惑可以回复我~ 2022-07-28 21:48:10
  • 提问者 酷乐虎 回复 清风 #3
    回复 老师,我按照视频装了好多遍了还是这样,现在master节点,执行kubectl get node, kubectl get pod -n kube-system 都是 The connection to the server 192.168.56.101:6443 was refused,重启docker和kubelet 能正常运行,过10分钟又访问不了了,是centos镜像还是网络问题,我网上搜了好多方案都解决不了,虚拟机配置又网卡能访问本地也能访问外网,本地也能ping通虚拟机,我的是windows系统,目前找不到解决方案了,卡到这里了
    回复 有任何疑惑可以回复我~ 2022-09-02 11:24:08
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号