今天在Kubernetes的从节点上运行命令【kubectl】出现了如下错误:

[root@k8snode1 kubernetes]# kubectl get pod The connection to the server localhost:8080 was refused - did you specify the right host or port?

出现这个问题的原因是kubectl命令需要使用kubernetes-admin来运行,解决方法如下,将主节点中的【/etc/kubernetes/admin.conf】文件拷贝到从节点相同目录下,然后如提示配置环境变量:

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
也可以简单方法

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

source ~/.bash_profile
接着再运行kubectl命令就OK了

[root@172-19-102-78 ~]# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true"}

Kubernetes-kubectl The connection to the server localhost:8080 was refused -did you specify的更多相关文章

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

  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. k8s节点执行master命令报错 localhost:8080 was refused

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

  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. 【kubernetes】kubectl logs connection refused

    因为启动dashboard报CrashLoopBackOff错误,尝试使用logs去查看日志,结果报错,错误如下: [root@localhost ~]# kubectl -s http://192. ...

  8. [nginx] connect() failed (111: Connection refused) while connecting to upstream, client: 101.18.123.107, server: localhost,

    nginx一直报错, 2016/12/02 10:23:19 [error] 1472#0: *31 connect() failed (111: Connection refused)while c ...

  9. 快速解决mysql Lost connection to MySQL server at 'reading initial communication packet及can't connect to mysql server on 'localhost'

    今天在使用Navicat连一个远程mysql时,总是提示连接不成功,提示Lost connection to MySQL server at 'reading initial communicatio ...

随机推荐

  1. BZOJ4886 [Lydsy1705月赛]叠塔游戏[基环树]

    很妙的一道题. 由于本人过于zz,不会这道题,通过厚颜无耻翻阅题解无数终于懂了这道题,所以这里转载一位神仙的blog. 没有看懂?没事,再来一篇. 这题个人认为主要在于转化题意和建图,这两点想通了应该 ...

  2. 【UVALive-7040F】Color

    题目大意:给定一个长度为 N 的序列,现有 M 种颜色,选出一些颜色对这个序列进行染色,要求相邻元素颜色不相同.求最终序列恰好有 K 种不同颜色的染色方案数,结果对1e9+7取模. 题解:二项式反演 ...

  3. esxi克隆虚拟机

    1.->选中虚拟机->导出(需要关闭虚拟机电源) 此时会下载下两个文件: 2.新建虚拟机 ->从OVF或OVA文件部署虚拟机 然后创建虚拟机,选择第二项 然后填入新虚拟机名称,并把下 ...

  4. Java8-Stream-No.13

    import java.security.SecureRandom; import java.util.Arrays; import java.util.stream.IntStream; publi ...

  5. spring @Primary-在spring中的使用(转)

    在spring 中使用注解,常使用@Autowired, 默认是根据类型Type来自动注入的.但有些特殊情况,对同一个接口,可能会有几种不同的实现类,而默认只会采取其中一种的情况下 @Primary ...

  6. [Python自学] day-17 (jQuery)

    一.jQuery简介 参考文档链接:http://jquery.cuishifeng.cn/ jQuery是JS的一个类库,是对DOM.BOM等的封装,方便我们来查找和操作元素. jQuery分为1. ...

  7. LinkedBlockingQueue 实现 生产者 消费者

    转载:https://blog.csdn.net/sinat_36553913/article/details/79533606 Java中使用LinkedBlockingQueue实现生产者,消费者 ...

  8. NetMQ介绍

    NetMQ 是  ZeroMQ的C#移植版本. 一.ZeroMQ ZeroMQ(Ø)是一个轻量级的消息内核,它是对标准socket接口的扩展.它提供了一种异步消息队列,多消息模式,消息过滤(订阅),对 ...

  9. python 二维数组 转 矩阵

    x = numpy.array([[,,],[,,],[,,]]) print x print x.shape 输出 [[ ] [ ] [ ]] (3L, 3L) [Finished .2s]

  10. codeforces gym #101161H - Witcher Potion(状压DP)

    题目链接: http://codeforces.com/gym/101161/attachments 题意: 总共有n瓶药可供选择 每瓶药可以增加$e_i$点体力,和$p_i$点毒性 每分钟消耗1点毒 ...