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?该如何处理这个错误提示表示kubectl命令无法连接到Kubernetes API Server,可能是因为指定的主机名或端口号不正确,或者API Server没有启动或无法访问。 阅读详情

执行命令:sshpass -p XXX ssh root@192.168.1.222 "kubectl create -f /root/nginx-deploy.yaml"

报错:

W1208 02:50:04.426384    4100 factory_object_mapping.go:423] Failed to download OpenAPI (Get http://localhost:8080/swagger-2.0.0.pb-v1: dial tcp [::1]:8080: getsockopt: connection refused), falling back to swagger
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

解决方法:

需要开启api server 代理端口:

查看端口是否代理:curl localhost:8080/api

开启端口代理:kubectl proxy --port=8080 &

参考:https://yq.aliyun.com/articles/149595

k8s:The connection to the server localhost8080 was refused - did you specify the right host or port Kubernetes-kubectl命令出现错误The connection to the server localhost:8080 was refused - did you specify the right host or port? 今天在Kubernetes的从节点上运行命令【kubectl】出现了如下错误 root@k8s-master1:~# kubectl get nodes The connection to the server localhost:8080 was refused 阅读详情

相关推荐

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

关于k8s类似于:The connection to the server localhost:8080 was refused - did you specify the right host or port?的toubleshooting

qq_29700227的博客 1310

《Kubernetes》-- kubectl get nodes报错:The connection to the server localhost:8080

K8S初始化后,worker节点加了master节点,在master执行kubectl get nodes 报错,这个原因看是路径的问题导致。在/etc/kubernetes目录下,通过kubectl --kubeconfig命令执行,是没有问题。

爱意随风起,人生不可弃。 1万+

The connection to the server localhost:8080 was refused

执行命令:$ kubectl get nodes 报错如下:The connection to the server localhost:8080 was refused - did you specify the right host or port? 报错说明:这个错误在 master 和 node 节点上都有可能出现,报错是与服务器连接被拒绝。解决方案:master$ mkdir -p $HOME/.kube $ cp -i /etc/kubernetes/admin.conf $HOME/.kube

qq_46654855的博客 6729

二进制安装The connection to the server localhost:8080 was refused - did you specify the right host

二进制安装k8s报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

wenwentana的博客 4821

Kubernetes kubectl命令出现错误【The connection to the server localhost:8080 was refused - did you specif

接着再运行kubectl命令就OK了。

专注基础架构领域 3792

eMMC FFU固件更新实战:从协议解析到设备修复

本文详细解析eMMC FFU固件更新技术,从协议原理到实战操作,涵盖EXT_CSD寄存器操作、命令流状态机解析及专业工具使用指南。通过真实维修案例,展示如何利用FFU机制修复设备故障,并提供高级优化技巧与安全注意事项,是硬件工程师和维修技术人员的实用参考。

weixin_29191761的博客 383

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

问题分析 环境变量 原因:kubenetes master没有与本机绑定,集群初始化的时候没有绑定,此时设置在本机的环境变量即可解决问题。 问题图片 解决方式 步骤一:设置环境变量 具体根据情况,此处记录linux设置该环境变量 方式一:编辑文件设置 vim /etc/profile 在底部增加新的环境变量 export KUBECONFIG=/etc/kubernetes/admin.conf 方式二:直接追加文件内容 echo "export KUBECONFIG=/etc/kub

CEVERY的博客 9万+

从STM32F411到华大HC32F460:一个真实项目移植的踩坑与填坑全记录

本文详细记录了从STM32F411移植到华大HC32F460芯片的全过程,包括开发环境搭建、时钟树配置、中断处理、外设驱动、看门狗陷阱、Flash操作和低功耗设计等关键坑点及解决方案。特别针对HC32F460的200MHz主频、双PLL架构和HSRUN模式等特性进行了深入分析,为工程师提供实用的移植指南,帮助节省大量调试时间。

weixin_33691817的博客 421

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

1.问题 2.原因 kubectl命令需要使用kubernetes-admin来运行,需要admin.conf文件(conf文件是通过“ kubeadmin init”命令在主节点/etc/kubernetes 中创建),但是从节点没有conf文件,也没有设置 KUBECONFIG =/root/admin.conf环境变量,所以需要复制conf文件到从节点,并设置环境变量就OK了 3.资料 https://github.com/kubernetes/kubernetes/issues/50295 htt

whatzhang007的博客 4万+

华为eNSP实战:手把手教你配置DHCP全局地址池(含AP固定IP分配)

本文通过华为eNSP模拟器,详细演示了如何配置DHCP全局地址池,为不同业务VLAN动态分配IP地址,并重点讲解了如何通过MAC地址绑定为接入点(AP)分配固定IP。文章涵盖了从拓扑设计、基础网络搭建到地址池精细配置、验证测试及常见故障排查的全流程,是网络工程师掌握企业级DHCP部署与AP管理的实用指南。

weixin_29235923的博客 601

VSCode搭配Keil开发STM32:从环境配置到代码跳转全流程(避坑指南)

本文详细介绍了如何使用VSCode搭配Keil进行STM32开发,从环境配置到代码跳转的全流程指南。通过安装必备插件和正确配置项目文件,开发者可以在VSCode中享受现代编辑器的便捷功能,同时保留Keil的编译调试能力,提升嵌入式开发效率。

weixin_28832121的博客 253

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

看到访问8080,其实很奇怪。检查发现没有~/.kube/config,,,find全局找了一下不在root用户下了。安装的 Kubernetes 集群中,如果 ~/.kube/config。丢失或者没生成,可以通过 apiserver 的原始配置重新生成。文件,它就是 kubeconfig 文件,只是没有复制到。),否则需要手动补充 apiserver 信息和证书。✅ 如果 admin.conf 丢了,用。都找不到,只能手动生成。你这个情况很常见 👍,在使用。初始化时,其实已经生成了。

喝醉酒的小白 1005

使用Zed 实现测距

此代码基于官方代码基础上进行改写,主要是获取zed相机深度画面的深度值,为yolo测距打基础。Zed相机是由Stereolabs公司开发的一种先进的立体视觉相机。这种相机专为计算机视觉和机器学习应用而设计,能够提供高质量的3D捕捉和分析功能。: Zed相机配备有一对垂直排列的传感器,能够捕捉两个略有偏移的图像,从而模拟人的双眼视觉,实现深度感知。: 利用立体成像技术,Zed相机能够实时生成环境的3D模型,这对于机器人导航、增强现实(AR)和虚拟现实(VR)等应用至关重要。

weixin_45303602的博客 915

已解决—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 the right host or port? 原因:kubectl命令需要使用kubernetes-admin来运行,需要admin.conf文件;而admin.conf 文件是通过 “kubeadmin init” 命令在 /etc/kubernetes 中创建的,从节点没有该配置文件;因此需要将admin

m0_55691056的博客 9537

RK3588开发笔记-ISP模块参数调试

本文详细介绍了基于RK3588平台的ISP模块参数调试流程。主要内容包括:硬件准备(RK3588板卡、IMX415摄像头等)、软件环境搭建(Ubuntu系统、RKISP_Tuner工具)、IMX415摄像头基础使用验证、RKISP2.x Tuner工具的使用方法(新建/加载IQ参数文件、Sensor配置、Raw图采集)以及最终IQ文件的部署。文章重点强调了基础标定的重要性,建议开发者分场景调试并参考官方文档,通过合理配置ISP参数来优化图像质量。该调试流程适用于RK3588平台的图像采集类项目开发。

flypig has a dream! 840

openclaw-cn : 无法将“openclaw-cn”项识别为 cmdlet、函数、脚本文件或可运行程序的名称 解决方案

本文主要介绍了openclaw-cn : 无法将“openclaw-cn”项识别为 cmdlet、函数、脚本文件或可运行程序的名称解决方案,希望能对使用openclaw-cn的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 10万+

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

在节点上使用kubectl命令时报The connection to the server localhost:8080 was refused - did you specify the right host or port的错误,这是因为kubernetes master没有与本机绑定,集群初始化的时候没有绑定,此时设置在本机的环境变量即可解决问题。 在/etc/profile文件末尾增加 export KUBECONFIG=/etc/kubernetes/kubelet.conf 然后执行s.

Merandღ的博客 4684

SpringBoot中使用FastJson解析Json数据

场景 1.SpringBoot默认配置的是Jackson。 2.项目搭建专栏: https://blog.youkuaiyun.com/BADAO_LIUMANG_QIZHI/column/info/35688 实现 引入fastJson的依赖 <!-- fastjson的依赖 --> <dependency> <groupId>com.alibab...

BADAO_LIUMANG_QIZHI的博客 4140

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

K8s集群初始化成功后,kubectl get nodes 查看节点信息时报错 报错信息:The connection to the server localhost:8080 was refused - did you specify the right host or port? 解决方法: 执行以下命令 mkdir -p $HOME/.kube sudo cp -i /e...

仲夏宁叶香的博客 6万+

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

上一篇: 如何创建软连接
下一篇: kubenetes 1.4 安装后8080端口无法访问
王树民
博客等级 码龄10年 912粉丝 560原创
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值