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

这篇具有很好参考价值的文章主要介绍了The connection to the server localhost:8080 was refused - did you specify the right host or port?。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

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

问题背景

使用 kubeadm 安装完成 kubetnetes 之后,将节点加入 master 之后,提示 The connection to the server localhost:8080 was refused - did you specify the right host or port?

[root@master ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

问题解决

方法1

查看 /etc/kubernetes/ 目录下是否存在 kubelet.conf 或者 admin.conf (个人理解只是文件名称不同),然后将上述两个文件路径写入到 /etc/profile 环境变量配置文件中

echo "/etc/kubernetes/admin.conf" >> /etc/profile
或者
echo "/etc/kubernetes/kubelet.conf" >> /etc/profile

source /etc/profile
[root@master ~]# kubectl get nodes
NAME     STATUS     ROLES                  AGE     VERSION
master   NotReady   control-plane,master   5m56s   v1.23.0
node1    NotReady   <none>                 5m17s   v1.23.0
node2    NotReady   <none>                 5m15s   v1.23.0
方法2

拷贝k8s认证文件

参考官网:官网地址

官网中有对 TLS 证书错误 做解答
The connection to the server localhost:8080 was refused - did you specify the right host or port?,kubernetes,kubernetes,kubetnetes提示

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

# 查看节点信息,如果没有拷贝认证文件,是看不到节点信息的
kubectl get nodes

The connection to the server localhost:8080 was refused - did you specify the right host or port?,kubernetes,kubernetes,kubetnetes提示

由于没有配置网络插件,所以这里看到节点信息都是 NotReady (未就绪)的

问题总结

安装参考文档:https://blog.csdn.net/D1179869625/article/details/126303213

 
 
 
 
 文章来源地址https://www.toymoban.com/news/detail-516019.html

到了这里,关于The connection to the server localhost:8080 was refused - did you specify the right host or port?的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • k8s--重启后报错:The connection to the server lb.kubesphere.local:6443 was refused - did you specify the r

    执行这个命令报错:The connection to the server lb.kubesphere.local:6443 was refused - did you specify the r kubectl get pod -A 如果你之前是正常运行的话,只用等待就行了,因为这个错是k8s主节点的kubectl还没启动的原因,所以会报这个错!! 一般等个2分钟左右在执行命令:

    2024年02月11日
    浏览(37)
  • 记一次k8s报错:The connection to the server ip:6443 was refused - did you specify the right host or port?

    敲击kubectl任意命令提示无法连接到10.75.78.212 的6443端口 kube-apiserver 默认端口无法连接,初步判断 kube-apiserver 服务出现问题 这里简单总结下kube-apiserver组件: kube-apiserver 是 Kubernetes 控制平面的枢纽,负责处理所有的 API 调用,包括集群管理、应用部署和维护、用户交互等,并

    2024年04月10日
    浏览(153)
  • 《Kubernetes》-- kubectl get nodes报错:The connection to the server localhost:8080

    在使用Kubernetes(K8S)集群管理工具时,常会使用 kubectl 命令来管理集群的节点和资源。 其中, kubectl get nodes 命令用于查看集群中的节点状态。然而,有时候执行该命令时会遇到报错信息:“The connection to the server localhost:8080 was refused - did you specify the right host or port?”。本文将

    2024年01月25日
    浏览(34)
  • k8s遇 The connection to the server :6443 was refused

    一般而言,6443端口是用于给apiserver使用的,如果报这个错误,就说明apiserver要么没起来,要么就是端口被占用了。 挨个检查以下几个守护进程有无问题,如果有报错日志,则需要进行排查 如果都没有问题,那就查看apiserver容器是否起来了 如果apisever没有正常运行中,就需要

    2024年01月19日
    浏览(44)
  • K8s 重设解决 “The connection to the server xxx:6443 was refused” 问题

    有时 kubectl 执行命令时出现问题,无法连接 kube-apiserver,报错如下: 初步判断,kubelet 没有将 apiserver 拉起来。 上面报错说明 kubelet 没有正常启动。 日志如下: 注意,在生产环境谨慎执行,在测试环境可以考虑使用。注意,在 master 节点上操作。 这部分详细的可以参考 K8s

    2024年02月04日
    浏览(42)
  • 树莓派VNC控制报错:The connection was refused by the computer 已解决

    在进行VNC远程操控树莓派的时候,出现了这个错误:The connection was refused by the computer。 大概原因有两个:一个是树莓派的IP地址更改了,另一个就是树莓派的VNC服务没有开启。 我的这块板子是个新板子,原因很显然是后者。解决方法如下: 1.打开PUTTY登录树莓派 2. 输入自己树

    2024年02月08日
    浏览(35)
  • k8s重启报错:Get “http://localhost:8080/api?timeout=32s“: dial tcp [::1]:8080: connect: connection refuse

    单从报错可以看出,kubectl 没有使用到证书与k8s api通信,在初始化集群的时候要想使用kubectl需要,申明证书变量 export KUBECONFIG=/etc/kubernetes/admin.conf ,重启之后 KUBECONFIG 变量失效了。所有需要重新声明,并加入过/etc/profile 全局变量文件。

    2024年04月27日
    浏览(42)
  • Refused to execute script from ‘http://localhost:8080/login.html‘

    最近学习SpringSecurity,在添加了SpringSecurity依赖后导致原先的网站图片、js代码都显示不出来了,浏览器报错,代码如下 原因,将静态页面、JS、img等资源都放在了resource的static文件夹下,导致security默认拦截了这些请求,从而访问页面时组件的事件不起作用,控制台报错如下

    2024年02月07日
    浏览(26)
  • Did not attempt to load JSON data because the request Content-Type was not ‘application/json‘

    在使用flask-restfull进行API开发的时候。一旦我使用类似下面的代码从url或者form中获得参数就会出现报错:Did not attempt to load JSON data because the request Content-Type was not ‘application/json’。 代码如下: 解决方法如下

    2024年02月16日
    浏览(53)
  • AnyConnect was not able to establish connection to the specified secure gateway

    讲述一下在使用 Cisco AnyConnect Secure Mobility Client连接公司VPN遇到AnyConnect was not able to establish connection to the specified secure gateway的解决方法。 我的是Win11系统。安装的版本是3.0。 1:去掉Internet连接共享的勾勾 控制面板-网络和Internet-网络和共享中心-更改适配器设置-右击,点击属

    2024年02月11日
    浏览(78)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包