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. 最新2019Java调用百度智能云人脸识别流程

    首先先注册账户 https://console.bce.baidu.com/?fromai=1#/aip/overview 点击链接 有账户直接登录  如无 则注册 进入控制台后 点击人脸识别 随便选 ...

  2. js复制图片

    ^(* ̄(oo) ̄)^:可以复制到微信和钉钉,文件夹中不可以复制 <!DOCTYPE html> <html lang="en"> <head> ...

  3. temp_laijx_2023

    ############################ [{\"itemKey\": \"jenkinsConfig\",\"itemValue\& ...

  4. RocketMQ学习笔记

    RocketMQ学习笔记 RocketMQ学习参考官网文档:https://github.com/apache/rocketmq/tree/master/docs/cn . 由于RocketMQ是有国 ...

  5. 哲讯分享:sap软件多少钱一套

    SAP软件一般指SAP. SAP,为"System Applications and Products"的简称,是德国SAP公司的产品--企业管理解决方案的软件名称.至今世界500 ...

  6. springcloud(三) - 负载均衡Ribbon

    功能介绍 基本保证每个服务不同的ip接收到的请求数量是一样的,确保在微服务下没有没有那个服务器负载过多而另外一个闲置. IRule:根据规则获取制定的服务 规则列表 RoundRobinRule:轮询 ...

  7. shell 每秒调用某个地址的方法

    #!/bin/bash step=1 for (( i = 0; i < 60; i=(i+step) )); do curl http://fn.k6akg6f.bar/chat.php sl ...

  8. 【二】python学习总结

    一i.python概念 python是一种解释型语言,速度比java慢 二.运算符和格式输出.导入 1.Python3 运算符 | 菜鸟教程 (runoob.com) 2.格式输出 %  和.form ...

  9. Yocto Project Mega-Manual 英文版 (2020官方最新合并版575页),Yocto官方文档中文版,Yocto官方文档英文版

    Yocto Project Mega-Manual-(2020官方最新合并版575页)-英文版 https://market.m.taobao.com/app/idleFish-F2e/widle-t ...

  10. Java反射获取方法参数名

      正常环境下,获取不到参数的名称,使用java反射时,第一个参数名是arg0,第二个参数是arg1,与我们代码中写的对不上. java反射过程中,需要我们做好判断: if(!parameter.is ...