k8s:The connection to the server localhost:8080 was refused - did you specify the right host or port?
前言
k8s 集群 node节点报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?
通过 kubectl get nodes 查看集群的情况,出现了报错,内容如下:
$ kubectl get pod
E0529 02:28:59.776677 415799 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0529 02:28:59.777439 415799 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0529 02:28:59.778983 415799 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0529 02:28:59.780888 415799 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0529 02:28:59.782303 415799 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
原因:
kubectl 默认从 ~/.kube/config 配置文件获取访问 kube-apiserver 地址、证书、用户名等信息,如果没有配置该文件会读取默值,即 localhost:8080,而本机的 localhost:8080 没有服务因而报 The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决
先检查当前 kubectl 配置加载信息,kubectl config view,如果为空需要检查 /etc/kubernetes/admin.conf 配置文件和 $HOME/.kube/config 配置,如果不存在,需要复制master节点上的配置到当前节点上
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
指定配置文件路径
如果你的配置文件不在默认路径,可以通过 KUBECONFIG 环境变量指定路径,或者在命令行中使用 --kubeconfig 选项。
使用 KUBECONFIG 环境变量
export KUBECONFIG=/path/to/your/kubeconfig
kubectl config view
使用 --kubeconfig 选项
kubectl --kubeconfig=/etc/kubernetes/admin.conf config view
k8s:The connection to the server localhost:8080 was refused - did you specify the right host or port?的更多相关文章
- 使用二进制方式安装K8S时使用kubectl命令报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决思路: kubectl 默认从 ~/.kube/config 配置文件获取访问 kube-apiserver 地址.证书.用户名等信息,如果没有配置该文件,或者该文件个别参数配置出错,执行命令时出 ...
- 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? 解决 ...
- kubernetes 报错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? 环境 ...
- Kubernetes-kubectl The connection to the server localhost:8080 was refused -did you specify
今天在Kubernetes的从节点上运行命令[kubectl]出现了如下错误: [root@k8snode1 kubernetes]# kubectl get pod The connection t ...
- 【Kubernetes】The connection to the server <master>:6443 was refused - did you specify the right host or port?
不知道怎么用着用着,使用kubectl 时报错,错误如下: root@R740--:~# kubectl get pod The connection to the server 107.105.13 ...
- kubectl error: The connection to the server localhost:8080 was refused
did you run below commands after kubeadm init To start using your cluster, you need to run (as a reg ...
- k8s节点执行master命令报错 localhost:8080 was refused
首先是按照二进制方式安装的k8s. [root@ht22 calico]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [ ...
- 虚拟机中MySQL连接问题:Lost connection to MySQL server at 'reading initial communication packet, system error: 0 以及 host is not allowed to connect mysql
环境:在VirtualBox中安装了Ubuntu虚拟机,网络使用了NAT模式,开启了端口转发. 局域网内其他计算机访问虚拟机中的MySQL Server出现两个问题: Lost connection ...
- k8s遇坑:The connection to the server k8s-api.virtual.local:6443 was refused - did you specify the right host or port?
k8s坑The connection to the server localhost:8080 was refused - did you specify the right host or port ...
- K8s - 解决主机重启后kubelet无法自动启动问题 错误:The connection to the server 192.168.60.128:6443 was refused - did you specify the right host or port?
1,问题描述 (1)在安装配置好 Kubernetes 后,正常情况下服务器关机重启,kubelet 也会自动启动的.但最近配置的一台服务器重启后,输入命令 kubectl get nodes 查看节 ...
随机推荐
- Qt编写跨平台视频监控系统(64通道占用7%CPU/支持win_linux_mac等)
一.前言 视频监控组件经历过数十年的迭代,从最初的只简单播放个rtsp视频流,到现在支持各种音频视频文件格式(mp3.wav.mp4.asf.rm.rmvb.mkv等).支持各种视频流格式(rtp.r ...
- [转]WorldWind开发中WorldWindowGLCanvas .setPreferredSize()函数找不到
值高温假期,无意翻到了csdn中三维GIS开发的专栏,讲的是worldwind Java三维GIS系统开发的东西,十分感兴趣.恰巧要求的环境已经存在,直接耍起来.将最新的Worldwind和JOGL下 ...
- 不为人知的网络编程(十五):深入操作系统,一文搞懂Socket到底是什么
1.引言 我相信大家刚开始学网络编程中socket的时候,都跟我一样对书上所讲的socket概念云里雾里的.似懂非懂,很是困扰. 这篇文章我打算从初学者的角度,用通俗易懂的文字,跟大家分享下我所理解的 ...
- CDS标准视图:功能位置可用标签 I_FUNCNLLOCALTERNATIVELABEL
视图名称:功能位置可用标签 I_FUNCNLLOCALTERNATIVELABEL 视图类型:基础 视图代码: 点击查看代码 @EndUserText.label: 'Functional Locat ...
- CDS标准视图:设备 I_Equipment
视图名称:I_Equipment 视图类型:基础视图 视图内容: 设备编码和设备内容 设备来源及详细信息 有效期 事务代码: IE03,IH08 视图代码 点击查看代码 @EndUserText.la ...
- Arcgis加载Geoserver矢量切片
原帖地址 洒家废物 - Arcgis加载Geoserver矢量切片 准备点线面图层并发布图层组 此处我准备了石家庄市的县界名称(点).高速公路(线).县界(面),依次发布geoserver服务,创建图 ...
- hackmyvm Hades5变量劫持提权
在这个目录下有个./uid的程序 分别运行./uid 和 id 发现我们在 uid一行是有不一样的 我们猜测 在./uid里面他先用chown把我们的 uid改写成了anthea 然后运行id 然后再 ...
- 解决webstorm无法识别@等,无法ctrl跳转问题,vue项目配置
1.1. 配置webpack.config.js文件 /*为了webstorm识别vite中设置的别名*/ 'use strict' const path = require('path') modu ...
- 探索未来之路,激发AI创新活力!“天翼云息壤杯”高校AI大赛北京区域赛开赛!
近年来,人工智能发展速度之快.辐射范围之广令人瞩目.今年的<政府工作报告>提出,深化大数据.人工智能等研发应用,开展"人工智能+"行动.AI充满了无限可能和潜力,未来还 ...
- 穿越周期!天翼云laaS+PaaS全年市场份额跃居中国公有云市场第三!
近日,国际数据公司(IDC)发布<中国公有云服务市场(2023下半年)跟踪>报告.中国电信天翼云在市场进入战略调整期的背景下,2023年H2实现公有云IaaS市场份额增长至12.9%,位居 ...