kubectl命令报错couldn't get current server API group list: Get "http://localhost:8080
一、搭建完成k8s平台,在从节点执行kubeclt命令报错
[root@node02 ~]# kubectl get pod E0218 10:58:33.139354 37437 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0218 10:58:33.140227 37437 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0218 10:58:33.143318 37437 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0218 10:58:33.145017 37437 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0218 10:58:33.147309 37437 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused The connection to the server localhost:8080 was refused - did you specify the right host or port?
报错信息
couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
二、解决办法
[root@node01 kubernetes]# mkdir ~/.kube
[root@node01 kubernetes]# cp /etc/kubernetes/kubelet.conf ~/.kube/config
重新登陆,问题解决
[root@node02 ~]# kubectl get pod NAME READY STATUS RESTARTS AGE nginx-test 1/1 Running 0 31m