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. MapReduce原理——切片代码分析

    (1)程序先找到数据存储的目录 (2)遍历目录对每个文件进行切片 (3)遍历一个文件: 获取文件大小 计算切片大小 默认情况下,切片大小等于blocksize 每次切片时都要判断剩下部分师否大于块的1 ...

  2. nginx重启报错 nginx: [error] open() “/run/nginx.pid“ failed (2: No such file or directory)

    原文: https://blog.csdn.net/CRMEB/article/details/120779362 nginx [error] open() "/usr/local/var/ ...

  3. 菜狗记录pycharm使用问题

    1.

  4. go 编程基础学习笔记

    dos 命令 2023-01-26 1.切换盘符 只要输入 c: d: e: 等即可 2.显示目录详细内容 dir 3.切换目录 cd 留意 一个点 . 代表当前目录, 两个点.. 代表上一级目录 4 ...

  5. 文件下载,后端接口,django,flask

    Django后端接口 def download_excel(request): """ get excel file from url param and upload ...

  6. ubuntu18.04 安装 opencv(版本4.5.5) cmake(版本3.25)

    参考链接:安装cmake     https://blog.csdn.net/Man_1man/article/details/126467371   安装 opencv  https://blog. ...

  7. OS-lab5

    OS-lab5 磁盘管理 完成文件系统的第一步就是要能够处理磁盘等外设的信息. lib/syscall_all.c 处理磁盘的信息,最基本的就是对磁盘进行读写操作. sys_write_dev函数用于 ...

  8. shell_Day06

    sed命令 Linux文本处理三剑客 之 sed sed stream EDite 作为行编辑器,对文本进行编辑(以行为单位进行编辑) 注意:sed编辑文件,却不改变原文件: sed的工作原理: 指定 ...

  9. 12.java链表栈和数组栈

    栈是一个先入后出的有序列表,栈是限制线性表中元素的插入和删除只能在线性表的同一端进行的一种特殊线性表,一端为变化的一端,称为栈顶,另一端是固定的,称为栈底.先入的元素在栈底,最后放入的元素在栈顶,删除 ...

  10. sxt_(001_003)_spring_ioc

    一.spring简介 Spring是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架.Spring框架是由于软件开发的复杂性而创建的.Spring使用的是基本的JavaBean来完成以前只可 ...