Kubernetes证书过期
证书过期提示
root@kubernetes # kubectl get nodes
Unable to connect the server: X509 certificate has expired or is not yet valid
操作步骤
1、查看证书有效期
kubeadm alpha certs check-expiration
或
openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text |grep 'Not'
2、证书备份
cp -rp /etc/kubernetes /etc/kubernetes.bak
3、重新生成证书
kubeadm alpha certs renew all
4、更新用户凭证
cp /etc/kubernetes/admin.conf ~/.kube/config
5、重启kubelet
systemctl restart kubelet
6、重启apiserver、scheduler、controller-manager容器
docker ps | grep apiserver
docker ps | grep scheduler
docker ps | grep controller-manager
docker restart containerID
7、检测是否生效
systemctl status kubelet
kubectl get nodes