首页 > 技术文章 > The connection to the server localhost:8080 was refused - did you specify the right host or port?

lph970417 2019-11-06 14:08 原文

kubectl get pod
The connection to the server localhost:8080 was refused - did you specify the right host or port?
出现这个问题的原因是kubectl命令需要使用kubernetes-admin来运行,解决方法如下,将主节点中 /etc/kubernetes/admin.conf 文件拷贝到从节点相同目录下,然后配置环境变量:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile

推荐阅读