k8s主节点报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

现象:

[root@k8s-master01 ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

 

原因:

网络没有搭建,搭建网络即可(细心的小伙伴会发现集群初始化时就有这个内容提示的)

[root@k8s-master01 home]#   mkdir -p $HOME/.kube
[root@k8s-master01 home]#   sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@k8s-master01 home]#   sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

 

 

posted on 2020-11-11 11:44  wangzy-Zj  阅读(1149)  评论(0编辑  收藏  举报