Kubernetes-kubectl命令出现错误【The connection to the server localhost:8080 was refused - did you specify

[root@master ~]# kubectl get node
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@master ~]# ll /etc/kubernetes/admin.conf 
-rw------- 1 root root 5562 Jun 13 21:26 /etc/kubernetes/admin.conf

[root@master ~]#   echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@master ~]# source .bash_profile 
[root@master ~]# kubectl get pods -all-namespace
Error: unknown shorthand flag: 'a' in -all-namespace
See 'kubectl get --help' for usage.
[root@master ~]# kubectl get pods --all-namespace
Error: unknown flag: --all-namespace
See 'kubectl get --help' for usage.
[root@master ~]# kubectl get pods --all-namespaces
NAMESPACE     NAME                             READY   STATUS    RESTARTS   AGE
kube-system   coredns-5897cd56c4-6mt6l         0/1     Pending   0          58m
kube-system   coredns-5897cd56c4-hz5xc         0/1     Pending   0          58m
kube-system   etcd-master                      1/1     Running   0          58m
kube-system   kube-apiserver-master            1/1     Running   0          58m
kube-system   kube-controller-manager-master   1/1     Running   0          58m
kube-system   kube-proxy-xcnpb                 1/1     Running   0          58m
kube-system   kube-scheduler-master            1/1     Running   0          58m

你可能感兴趣的:(kubernetes,docker,网络)