执行kubectl错误The connection to the server localhost:8080 was refused
今天在node上执行kubectl get pod结果出现报错[root@cm-server ~]# kubectl get podThe connection to the server localhost:8080 was refused - did you specify the right host or port?查阅资料后才知道kubectl命令需要使用kubernetes-...
·
今天在node上执行kubectl get pod结果出现报错
[root@cm-server ~]# kubectl get pod
The connection to the server localhost:8080 was refused - did you specify the right host or port?
查阅资料后才知道kubectl命令需要使用kubernetes-admin来运行,而node上并没有admin.conf文件。将master上的admin.conf文件拷贝到node,然后执行一下命令
[root@cm-server ~]# cd /etc/kubernetes/
[root@cm-server kubernetes]# ls
bootstrap-kubelet.conf kubelet.conf manifests pki
[root@cm-server kubernetes]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@cm-server kubernetes]# source ~/.bash_profile
再次执行kubectl get pod命令就可以使用了。
更多推荐
已为社区贡献1条内容
所有评论(0)