我是靠谱客的博主 怕黑蜜粉,这篇文章主要介绍Kubernetes-kubectl命令出现错误【The connection to the server localhost:8080 was refused - did you specif......,现在分享给大家,希望可以做个参考。

  今天在Kubernetes的从节点上运行命令【kubectl】出现了如下错误

[root@k8snode1 kubernetes]# 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

接着再运行kubectl命令就OK了

img_1103f565eadb0c80de00321f888ebbb7.png
get pod

最后

以上就是怕黑蜜粉最近收集整理的关于Kubernetes-kubectl命令出现错误【The connection to the server localhost:8080 was refused - did you specif......的全部内容,更多相关Kubernetes-kubectl命令出现错误【The内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(117)

评论列表共有 0 条评论

立即
投稿
返回
顶部