问题解决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
CSDN 社区图书馆,开张营业! 深读计划,写书评领图书福利~

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

k8s The connection to the server was refused 问题解决记录

问题解决:The connection to the server xxxxx:6443 was refused - did you specify the right host or port?

问题解决:The connection to the server xxxxx:6443 was refused - did you specify the right host or port?

安装Kubernetes报错:The connection to the server localhost:8080 was refused

Error connecting to the Service Control Manager: 拒绝访问 Mongodb问题-解决

Yii “CDbConnection failed to open the DB connection: could not find driver"解决办法