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

环境变量

原因:kubernetes master没有与本机绑定,集群初始化的时候没有绑定,此时设置在本机的环境变量即可解决问题。

解决方式

步骤一:设置环境变量

具体根据情况,此处记录linux设置该环境变量
方式一:编辑文件设置
vim /etc/profile
在底部增加新的环境变量 export KUBECONFIG=/etc/kubernetes/admin.conf
方式二:直接追加文件内容
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /etc/profile

步骤二:使生效

source /etc/profile

解决问题后截图:

sudo kubectl get pods -n kube-system

https://blog.csdn.net/CEVERY/article/details/108753379

kubernetes 报错The connection to the server localhost:8080 was refused - did you specify the right host or port?的更多相关文章

  1. 使用二进制方式安装K8S时使用kubectl命令报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

    解决思路: kubectl 默认从 ~/.kube/config 配置文件获取访问 kube-apiserver 地址.证书.用户名等信息,如果没有配置该文件,或者该文件个别参数配置出错,执行命令时出 ...

  2. 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? 解决 ...

  3. 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 ...

  4. 【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 ...

  5. 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 ...

  6. 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 ...

  7. k8s节点执行master命令报错 localhost:8080 was refused

    首先是按照二进制方式安装的k8s. [root@ht22 calico]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [ ...

  8. idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost connection toMySQL server at

    我是使用navicat的windows端 连接centos下mysql服务器 第一次常规连接mysql正常,idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost co ...

  9. MySQL忘记密码,或:root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案

    MySQL root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案   1  登陆失败,mysqladmin修改密码失败 ...

  10. MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed

    MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed 1.安装完MySQL设置root密码报错如下 [root@vm ...

随机推荐

  1. 蓝牙mesh组网实践(选择性配网与自配网参数分析)

    目录 使用配网器配网方式: 在之前的文章中介绍了CH582单片机在蓝牙mesh组网中的两种配网方式,有介绍到:未配网设备不能选择被哪个配网器配网,配网器可以选择给哪个未配网设备配网.接下来介绍在哪里可 ...

  2. Mysql -七种Join

  3. [Docker-1自顶向下学习Docker

    本文目录: 什么是DOCKER? 什么是容器? 什么是DOCKER镜像? DOCKER有什么使用场景和优势? 流程图一:从中央仓库拉取镜像并部署 流程图二:上传镜像到中央私库 结语   什么是DOCK ...

  4. 25 String 对象中的属性

    <!DOCTYPE html> <html lang="en">   <head>     <meta charset="UTF ...

  5. 最简spring IOC实现

    public class Main { public static void main(String[] args) throws Exception { Class<Address> a ...

  6. insert_base_x.txt

    insert into g_temp.test_basevalues('20220202'::date, 1, 'apple'),('20220203'::date, 5, 'banana'),('2 ...

  7. [笔记]windows cmd常用命令

    1.返回上一级目录  目前似乎没有直接的命令,参考  https://stackoverflow.com/questions/48189935/how-can-i-return-to-the-prev ...

  8. android系统签名文件路径及签名方法

    在系统源码路径下 签名文件路径:android/build/target/product/security/ 准备好签名工具:"signapk.jar" 位置:android/pr ...

  9. 基于Mybatis Plus的一种查询条件构建方案

    ! 重要: 遐(瞎)想的思路, 希望各位多多建议 record为jdk17写法, 使用class也不会有问题 背景 身为资深程序员, 上班最重要的事当然是增删改查(bushi). 比如今天, 组长甩给 ...

  10. Java期末课程设计--购物车的GUI(编辑中)

    实现的功能 基本功能 使用admin登录 对商品表内的商品添加至购物车 结算价格 扩展功能 用户的登录注册(基于数据库) 钱包功能 结算前录入地址信息 丰富GUI(指插入图片) 管理员界面(对商品进行 ...