The connection to the server 192.168.43.12:6443 was refused - did you specify the right host or port?

现象:更改主机名或者服务器重启后出现报错

[root@master pki]# kubectl get pod -n kube-system
The connection to the server 192.168.43.12:6443 was refused - did you specify the right host or port?

 

 

解决办法:

1、查看服务是否启动,未启动则启动服务。若启动则跳过此步骤

The connection to the server 192.168.43.12:6443 was refused - did you specify the right host or port?_第1张图片

 

 

2、重新声明环境变量

[root@master pki]# ll /etc/kubernetes/admin.conf
[root@master pki]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@master pki]# source ~/.bash_profile
[root@master pki]# kubectl get pod -n kube-system
NAME                             READY   STATUS              RESTARTS   AGE
coredns-8686dcc4fd-6fthd         0/1     ContainerCreating   0          172m
coredns-8686dcc4fd-8lj7w         0/1     ContainerCreating   0          172m
etcd-master                      1/1     Running             0          171m
kube-apiserver-master            1/1     Running             0          172m
kube-controller-manager-master   1/1     Running             0          172m
kube-proxy-2f78w                 1/1     Running             0          172m
kube-proxy-lrjkw                 1/1     Running             0          162m
kube-proxy-pkbq8                 1/1     Running             0          167m
kube-scheduler-master            1/1     Running             0          172m

 

你可能感兴趣的:(The connection to the server 192.168.43.12:6443 was refused - did you specify the right host or port?)