昨天用两台银河麒麟V10搭建了一个k8s集群,搭建好久关机了,今天重新开机的时候master节点输入kubectl get node
输出:The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决方案:先确保在root模式
依次输入echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
和 source ~/.bash_profile
root@master:/# kubectl get node
The connection to the server 192.168.67.143:6443 was refused - did you specify the right host or port?
root@master:/# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
root@master:/# source ~/.bash_profile
root@master:/# kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready control-plane,master 10d v1.23.1
node01 Ready <none> 10d v1.23.1