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. 076_Master Detail 与Lookup

  2. 实验一-密码引擎-加密API研究

    实验一-密码引擎-加密API研究 API:应用程序接口(API:Application Program Interface)是一组定义.程序及协议的集合,通过 API 接口实现计算机软件之间的相互通信 ...

  3. [localhost-startStop-1]

    第一次遇到Tomcat在Linux服务器启动卡住的情况,情况很简单,tomcat启动以后卡在INFO: Deploying web application directory ......这句话,具体 ...

  4. Java基础学习:7、作用域

    1.在Java中,主要的变量就是属性(成员变量)和局部变量. 2.我们说的局部变量一般是指在成员方法中定义的变量. 3.Java作用域分类: 全局变量:作用域为整个类,该类中的方法可以使用. 局部变量 ...

  5. DC约束笔记

    关于get_pins get_cells get_ports等的定义 关于建立保持与max/min的关系 2.setup time和hold time 建立时间(setup time)是指在触发器的时 ...

  6. Go--生成excel表格,读取excel表格数据

    先下载第三方依赖包: go get -u github.com/xuri/excelize/v2 代码: package main import ( "fmt" "git ...

  7. 谷歌是如何改进 GKE、Cloud Run 的 gVisor 文件系统性能的?

    灵活的应用程序架构.CI/CD 管道和容器工作负载通常运行不受信任的代码,因此应该与敏感的基础设施隔离.一种常见的解决方案是部署纵深防御产品(如使用gVisor的GKE Sandbox)以通过额外的保 ...

  8. C++11之线程库

    在 C++11 之前,涉及到多线程问题,都是和平台相关的,比如 Windows 和 Linux 下各有自己的接口,这使得代码的可移植性比较差.C++11 中最重要的特性就是对线程进行支持了,并且可以跨 ...

  9. hive复制表

    create table talbe_copy as select * from talbe_origin;

  10. KMS服务器 激活win 和 office

    环境:Debian 9.5 (Google Cloud) 切换到root用户:sudo su wget --no-check-certificate https://github.com/teddys ...