$ kubectl get pods --all-namespaces
The connection to the server localhost:8080 was refused - did you specify the right host or port?
原因:
kube-apiserver默认只启动安全访问接口6443,而不启动非安装访问接口8080
解决方案:
$ sudo vi /etc/kubernetes/manifests/kube-apiserver.yaml
# 修改--insecure-port=8080
--insecure-port=0
重启kube-apiserver
$ sudo docker ps |grep 'kube-apiserver'
603d90351617 06924f18fe15 "kube-apiserver --..." 5 minutes ago Up 5 minutes k8s_kube-apiserver_kube-apiserver-kube-node1_kube-system_6a57a51e24c908ce9bda1e57855173b0_7
$ docker restart 603d90351617
网友评论