【The connection to the server localhost:8080 was refused - did you specify the right host or port?】

问题

k8s报错

$ kubectl get node

The connection to the server localhost:8080 was refused - did you specify the right host or port?

解决方法

将master节点中的 /etc/kubernetes/admin.conf 文件拷贝到node节点的相同目录下

sudo scp admin.conf 172.19.5.160:/etc/kubernetes/

进入worker节点,更改 admin.conf 权限

chmod 666 /etc/kubernetes/admin.conf

配置环境变量,使之生效

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
posted @ 2022-09-05 11:27  LMFrank  阅读(98)  评论(0)    收藏  举报