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

解决k8s集群在节点运行kubectl出现的错误:The connection to the server localhost:8080 was refused - did you specify the right host or port?

问题分析:

  解决办法:

    将主节点(master节点)中的【/etc/kubernetes/admin.conf】文件拷贝到从节点相同目录下:

scp -r /etc/kubernetes/admin.conf ${node1}:/etc/kubernetes/admin.conf

    配置环境变量:

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

    立即生效:

source ~/.bash_profile

具体操作截图:

 

posted @ 2021-03-08 11:31  fat_girl_spring  阅读(236)  评论(0编辑  收藏  举报