已经是最新一篇文章了!
已经是最后一篇文章了!
解决方法-The connection to the server localhost:8080 was refused - did you specify the right host or port?
部署Kubernetes集群时遇到的一些问题
概述
k8s集群在节点运行kubectl命令时出现错误:
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
版权声明: 如无特别声明,本文版权归 月梦の技术博客 所有,转载请注明本文链接。
(采用 CC BY-NC-SA 4.0 许可协议进行授权)
本文标题:《 解决方法-The connection to the server localhost:8080 was refused - did you specify the right host or port? 》
本文链接:https://ymiir.netlify.app//%E4%BA%91%E5%8E%9F%E7%94%9F/kubectl%E9%97%AE%E9%A2%98.html
本文最后一次更新为 天前,文章中的某些内容可能已过时!
评论