kubectl命令出现【The connection to the server localhost:8080 was refused - did you specify the right host or port?】的解决方法:

【The connection to the server localhost:8080 was refused - did you specify the right host or port?】

[root@k8s-master-1 kubernetes]# kubectl run snow --image=nginx:1.8
The connection to the server localhost:8080 was refused - did you specify the right host or port?

解决方法:
cp -i admin.conf /root/.kube/config

[root@k8s-master-1 ~]# cp -i /etc/kubernetes/admin.conf ./.kube/config

[root@k8s-master-1 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-1-6664c49886-56vqs 1/1 Running 0 17h
nginx-deployment-7848d4b86f-d5s2w 1/1 Running 1 20h
nginx-deployment-7848d4b86f-h8cnr 1/1 Running 1 20h

posted @ 2021-03-04 13:00  yyuuee  阅读(629)  评论(0编辑  收藏  举报