kubernetes v1.2.0进行kubectl version和kubectl get nodes出现localhost:8080 connection refused的问题

zhang_gq 发布于 2016/03/24 14:10
阅读 37K+
收藏 0

OSC年度开源问卷新鲜出炉,你的回答对我们很重要,参与开源可以从这份问卷开始>>>

Kubernetes组网为一个Master(安装etcd kubernetes-master)+一个minion(安装kubernetes-node docker flannel bridge-utils),配置完成后,Master节点似乎正常:

# kubectl get nodes
NAME             LABELS                                  STATUS    AGE
172.16.182.185   kubernetes.io/hostname=172.16.182.185   Ready     3h
# kubectl version
Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"86327329213fed4af2661c5ae1e92f9956b24f55", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"86327329213fed4af2661c5ae1e92f9956b24f55", GitTreeState:"clean"}

而minion节点

#kubectl version

Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"86327329213fed4af2661c5ae1e92f9956b24f55", GitTreeState:"clean"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

检查本地的8080端口如下:

# lsof -i:8080
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
kube-prox 16201 root    5u  IPv4  82287      0t0  TCP 172.16.182.185:45862->172.16.182.184:webcache (ESTABLISHED)
kube-prox 16201 root    6u  IPv4  83079      0t0  TCP 172.16.182.185:45861->172.16.182.184:webcache (ESTABLISHED)
kubelet   16336 root    8u  IPv4  77991      0t0  TCP 172.16.182.185:45753->172.16.182.184:webcache (ESTABLISHED)
kubelet   16336 root    9u  IPv4  77992      0t0  TCP 172.16.182.185:45754->172.16.182.184:webcache (ESTABLISHED)
kubelet   16336 root   10u  IPv4  77993      0t0  TCP 172.16.182.185:45755->172.16.182.184:webcache (ESTABLISHED)
kubelet   16336 root   12u  IPv4  77997      0t0  TCP 172.16.182.185:45756->172.16.182.184:webcache (ESTABLISHED)
kubelet   16336 root   13u  IPv4  77112      0t0  TCP 172.16.182.185:45757->172.16.182.184:webcache (ESTABLISHED)

加载中
0
atlasfly
atlasfly
该评论暂时无法显示,详情咨询 QQ 群:912889742
笨鸟不想飞
笨鸟不想飞
果然好使!
zhang_gq
zhang_gq
回复 @atlasfly : 果然好使!
atlasfly
atlasfly
通过-s 指定连接的server就能解决,貌似是minion主机上默认去连接localhost的8080端口
0
zhang_gq
zhang_gq

另外之前有个帖子说设置 alias kubectl='kubectl --kubeconfig=/etc/kubernetes/kubelet.kubeconfig',事实发现没用

# alias kubectl='kubectl --kubeconfig=/etc/kubernetes/kubelet.kubeconfig'
[root@minion1 kubernetes]# kubectl get nodes
error: stat /etc/kubernetes/kubelet.kubeconfig: no such file or directory

0
叫我查尔斯好了
叫我查尔斯好了
该评论暂时无法显示,详情咨询 QQ 群:912889742
码上中国博客
码上中国博客
/etc/kubernetes/路径下没有admin.conf文件
0
大倪巴
该评论暂时无法显示,详情咨询 QQ 群:912889742
0
Yanh_
Yanh_

也可能是在node节点服务器上,在master上就没问题

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部