报错现象: [root@localhost ~]# kubectl get nodes The connection to the server localhost:8080 was refused - did you specify the right host or port? 但是也想让子节点可以查询,因此研究了一下 把master下面的admin.conf移到子节点相同路径下 [root@localhost manifests]# cd /etc/kubernetes [root@loc
https://jimmysong.io/posts/kubectl-cheatsheet/ Kubectl Cheatsheet kubectl命令技巧大全Posted on November 3, 2017 东坝郊野公园 Aug 27,2016 Fri Nov 3, 2017 2400 Words|Read in about 5 Min Tags: kubernetes Kubectl 自动补全 Kubectl 上下文和配置 创建对象 显示和查找资源 更新资源 修补资源 编辑资源 Scale
解决思路: kubectl 默认从 ~/.kube/config 配置文件获取访问 kube-apiserver 地址.证书.用户名等信息,如果没有配置该文件,或者该文件个别参数配置出错,执行命令时出错:The connection to the server localhost:8080 was refused - did you specify the right host or port? 解决办法: 1 查看该文件是否存在,若不存在则生成 2 查看该文件内容是否有缺,尤其是server字