现象:

[root@localhost shell]# kubectl version
Client Version: version.Info{Major:"", Minor:"", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server 192.168.111.104: was refused - did you specify the right host or port?

查看进程

[root@localhost kubernetes]# ps -aux|grep kube
root 0.0 1.1 pts/ Sl : : kubectl proxy --port=
root 0.0 0.0 pts/ S+ : : grep --color=auto kube
kube 0.8 4.6 ? Ssl : : /usr/bin/kube-apiserver --logtostderr=true --v= --etcd-servers=http://127.0.0.1:2379 --insecure-bind-address=127.0.0.1 --allow-privileged=false --service-cluster-ip-range=10.254.0.0/16 --admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota
kube 2.2 2.4 ? Ssl : : /usr/bin/kube-controller-manager --logtostderr=true --v= --master=http://127.0.0.1:8080
kube 0.2 1.8 ? Ssl : : /usr/bin/kube-scheduler --logtostderr=true --v= --master=http://127.0.0.1:8080
root 0.9 2.2 ? Ssl : : /usr/bin/kube-proxy --logtostderr=true --v= --master=http://127.0.0.1:8080

关键进程kube-apiserver,kube-controller-manager,kube-scheduler,kube-proxy都在

解决

删除/etc/kubernetes/config

[root@localhost kubernetes]# cd /root/.kube
[root@localhost .kube]# ls
config
[root@localhost .kube]# cat config
apiVersion: v1
clusters:
- cluster:
certificate-authority: /root/.minikube/ca.crt
server: https://192.168.111.104:8443
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /root/.minikube/client.crt
client-key: /root/.minikube/client.key
[root@localhost .kube]# ls
config
[root@localhost .kube]# rm config
rm: remove regular file ‘config’? y

重启服务

[root@localhost .kube]# systemctl restart kube-apiserver
[root@localhost .kube]# systemctl restart kube-controller-manager
[root@localhost .kube]# systemctl restart kube-scheduler
[root@localhost .kube]# systemctl restart kube-proxy

验证

[root@localhost .kube]# kubectl version
Client Version: version.Info{Major:"", Minor:"", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
[root@localhost .kube]# ls
http-cache
[root@localhost .kube]# pwd
/root/.kube
[root@localhost .kube]# ls
http-cache
[root@localhost .kube]# cat http-cache/
cat: http-cache/: Is a directory
[root@localhost .kube]# kubectl get nodes
No resources found.

[root@localhost .kube]# kubectl get componentstatus
NAME STATUS MESSAGE ERROR
etcd-0 Healthy {"health":"true"}
scheduler Healthy ok
controller-manager Healthy ok
[root@localhost .kube]#


问题解决

网上方法k8s V1.11.1报错:The connection to the server localhost:8080 was refused,不过没有解决我的问题

kubectl version报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. 修改ubuntu DNS的步骤/wget url报错: unable to resolve host address的解决方法

    wget url 报错:unable to resolve host address ‘url’,显然是无法解析主机地址,这就能看出是DNS解析的问题.解决办法就是配置可用的dns 一般是修改成为谷歌 ...

  3. 启动hadoop报does not contain a valid host:port authority:node2_1:9000

    报错:启动hadoop报does not contain a valid host:port authority:node2_1:9000 原因:主机的hostname不合法,修改为不包含着‘.’ ' ...

  4. 关于github报错:ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

    当执行git命令如:git clone.git pull等等 出现报错:ssh: connect to host github.com port 22: Connection timed outfat ...

  5. Centos7 JDK安装过程中 解决java -version 报错: bash: /home/jdk1.8.0_161/bin/java: Permission denied

    1.执行Linux命令 -----vim /etc/profile  编辑profile  文件,在里面添加: #set java enviroment JAVA_HOME=/opt/JavaHome ...

  6. TDDL与Spring Boot集成Version报错——跟踪与解决

    先说背景:公司采用diamond+tddl,这套技术来做web管理.本人处于好奇率先体验了下spring-boot,于是就有了spring-boot+tddl的组合.但是jar包上线后,屡屡发现一条e ...

  7. Centos 7 JDK验证 解决java -version 报错: bash: /home/jdk1.8.0_161/bin/java: Permission denied

    2.vim /etc/profile  编辑profile  文件,在里面添加: #set java enviroment JAVA_HOME=/usr/java/jdk1.8.0_144 JRE_H ...

  8. 踩坑系列《三》 java -version 报错出现Error occurred during initialization of VM java/lang/NoClassDefFoundError:

    之前导入一个项目,因为该项目Spring版本过低,只能适用于1.7版本,装了jdk1.7版本.安装配置好后,打开cmd窗口,执行 java -version 指令发现没像正常一样显示版本信息,而是报了 ...

  9. 运行java -version报cannot restore segment prot after reloc: Permission denied

    linux 安装jdk1.6后,运行java -version,没有出现相关的版本信息,而是出现了以下错误: dl failure on line 685Error: failed /usr/loca ...

随机推荐

  1. vue-router2.0

    在使用vue.js创建单页运用的时候,我们通常的做法是配合vue-router一起使用,通过vue-router将组建映射到路由并进行渲染. 例如我们要实现两个页面的切换跳转,就需要使用路由,这里不再 ...

  2. 服务网关zuul之四:zuul网关配置

    禁用过滤器在Zuul中特别提供了一个参数来禁用指定的过滤器,该参数的配置格式如下:zuul.AccessFilter.pre.disable=true动态加载动态路由通过结合Spring Cloud ...

  3. jquery插件的几种写法

    /** * Created by peng on 2016/12/8. */jQuery.extend({ min: function(a, b) { return a < b ? a : b; ...

  4. 廖雪峰Java3异常处理-2断言和日志-4使用Log4j

    1.Log4j Log4j是目前最流行的日志框架.有两个版本 1.x:Log4j 2.x:Log4j2 Log4j下载地址https://www.apache.org/dyn/closer.lua/l ...

  5. k8s服务发现和负载均衡(转)

    原文 http://m635674608.iteye.com/blog/2360095 kubernetes中如何发现服务 如何发现pod提供的服务 如何使用kube-dns发现服务   servic ...

  6. OpenSips使用说明

    OpenSips使用说明 安装MYSQL 安装及初始化 下载地址:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-gli ...

  7. java 获取两个日期之间的所有天数

    Calendar start = Calendar.getInstance(); start.set(2017, 2, 20); Long startTIme = start.getTimeInMil ...

  8. 给 Windows 文件菜单添加 "用XX程序打开" "用XX编辑" "用XX运行"

    有什么用就不用多说了,这可是个很有用的技巧.可以创造自己的文件格式,也可以给已有的文件添加多种打开方式 在注册表[HKEY_CLASSES_ROOT]下找到或者建立对应的扩展名 如果想对所有文件都生效 ...

  9. protocol buf安装

    1:下载安装包 $wget https://github.com/google/protobuf/archive/v2.6.1.zip $unzip protobuf-2.6.1.zip $cd pr ...

  10. nginx完全关闭log

    nginx.conf中要在http一节里面添加 access_log off; error_log off;