问题解决The connection to the server localhost:8080 was refused

Posted 看,未来

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了问题解决The connection to the server localhost:8080 was refused相关的知识,希望对你有一定的参考价值。

问题分析

原因:kubernetes master没有与本机绑定,集群初始化的时候没有绑定,此时设置在本机的环境变量即可解决问题。

解决方式

步骤一:设置环境变量

具体根据情况,此处记录linux设置该环境变量
方式一:编辑文件设置

 vim /etc/profile
 在底部增加新的环境变量 export KUBECONFIG=/etc/kubernetes/admin.conf

方式二:直接追加文件内容

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /etc/profile

步骤二:使生效

source /etc/profile

以上是关于问题解决The connection to the server localhost:8080 was refused的主要内容,如果未能解决你的问题,请参考以下文章