The connection to the server localhost:8080 was refused - did you specify the right host or port?

Posted gramblog

tags:

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

今天在节点执行kubectl get pod命令时,报了上述错误

技术图片

 

 

出现这个问题的原因是kubectl命令需要使用kubernetes-admin来运行,解决方法如下,将主节点中的【/etc/kubernetes/】这个目录下的.conf文件拷贝到从节点相同目录下,然后配置环境变量:export KUBECONFIG=/etc/kubernetes/kubelet.conf就可以了
注:
  1、我查看了自己的节点目录【/etc/kubernetes/】,是有.conf文件的,所以我没有复制文件,直接设置了下环境变量就可以了
  2、网上基本上都是说是【/etc/kubernetes/】这个目录的admin.conf文件,但是我的【/etc/kubernetes/】目录下只有kubelet.conf,说明文件名不重要,只需要设置对应的环境变量就可以了
 
技术图片
技术图片

 

 


 

 

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

Ionic App 启动时报Application Error - The connection to the server was unsuccessful

kubectl error: The connection to the server localhost:8080 was refused

mysql错误 MacERR_WHEN_INSERT_TO_DB Error:Connection lost: The server closed the connection.

How to do if the GM MDI cant connect with the software

C# Mysql You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser

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