kubectl get nodes
等提示 Unable to connect to the server: x509: certificate has expired or is not yet valid 既为k8s的证书到期的提示
使用kubeadm安装k8s时,默认生成的client certificate的有效期是1年。master节点:xxx.xxx.xxx.xxx
kubeadm alpha certs check-expiration 或 openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text |grep ' Not '
cp -rp /etc/kubernetes /etc/kubernetes.bak
kubeadm alpha certs renew all
cp /etc/kubernetes/admin.conf ~/.kube/config -f
systemctl restart kubelet
docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd'|xargs docker restart
systemctl status kubelet
kubectl get nodes
scp root@masterIP:/etc/kubernetes/admin.conf /etc/kubernetes/ -f && cp /etc/kubernetes/admin.conf ~/.kube/config -f 或者拷贝到其他节点