解决方法
备份重新生成证书
# cd /etc/kubernetes/pki/ # mkdir backup # mv apiserver.crt apiserver-etcd-client.key apiserver-kubelet-client.crt front-proxy-ca.crt front-proxy-client.crt front-proxy-client.key front-proxy-ca.key apiserver-kubelet-client.key apiserver.key apiserver-etcd-client.crt backup #重新生成证书如果没有kubeadm-config.yaml可以重新拉取kubeadm配置 #kubectl get cm -n kube-system kubeadm-config -o yaml >kubeadm-config.yaml # kubeadm init phase certs all --config=/etc/kubernetes/kubeadm-config.yaml
备份并重新生成配置文件
# cd /etc/kubernetes/ # mkdir backup # mv admin.conf controller-manager.conf kubelet.conf scheduler.conf backup # kubeadm init phase kubeconfig all --config=/etc/kubernetes/kubeadm-config.yaml
配置config
# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
重启kubectl
# cd /var/lib/kubelet/pki/ #删除软连接 # rm -f kubelet-client-current.pem# systemctl daemon-reload # systemctl restart kubelet.service