kubectl get pods The connection to the server localhost:8080 was refused - did you specif...

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

原因:kubectl命令需要使用kubernetes-admin来运行。

解决办法:

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

2.配置环境变量
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

   3.立即生效

source ~/.bash_profile

 



posted @ 2020-04-21 15:35  Mr.peter  阅读(1213)  评论(0编辑  收藏  举报