Kubernetes-kubectl命令  The connection to the server localhost:8080 was refused -_bash

[root@docker001 yum.repos.d]# kubectl get pods --all-namespaces
The connection to the server localhost:8080 was refused - did you specify the right host or port?

[root@docker001 yum.repos.d]# ll /etc/kubernetes/admin.conf
-rw------- 1 root root 5450 Oct 23 14:10 /etc/kubernetes/admin.conf
[root@docker001 yum.repos.d]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

[root@docker001 yum.repos.d]# source ~/.bash_profile

[root@docker001 yum.repos.d]# source ~/.bash_profile
[root@docker001 yum.repos.d]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-5644d7b6d9-8vbs4 0/1 Pending 0 5m39s
kube-system coredns-5644d7b6d9-jc4zk 0/1 Pending 0 5m39s
kube-system etcd-docker001 1/1 Running 0 4m47s
kube-system kube-apiserver-docker001 1/1 Running 0 4m22s
kube-system kube-controller-manager-docker001 1/1 Running 0 4m42s
kube-system kube-proxy-bxhpn 1/1 Running 0 5m39s
kube-system kube-scheduler-docker001 1/1 Running 0 4m33s
[root@docker001 yum.repos.d]#

Kubernetes-kubectl命令  The connection to the server localhost:8080 was refused -_bash

 主:master节点  /etc/kubernetes/admin.conf 复制过来

Kubernetes-kubectl命令  The connection to the server localhost:8080 was refused -_docker_03