Unable to connect to the server: x509: certificate has expired or is not yet
1.備份pki目錄證書(shū)
cd /etc/kubernetes
tar -zcvf pki_bk.tar.gz pki
2.更新所有的證書(shū)
kubeadm alpha certs renew all
3.檢查證書(shū)的更新時(shí)間
[root@master kubernetes]# kubeadm alpha certs check-expiration
[check-expiration] Reading configuration from the cluster...
[check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Mar 25, 2023 05:17 UTC 364d no
apiserver Mar 25, 2023 05:17 UTC 364d ca no
apiserver-etcd-client Mar 25, 2023 05:17 UTC 364d etcd-ca no
apiserver-kubelet-client Mar 25, 2023 05:17 UTC 364d ca no
controller-manager.conf Mar 25, 2023 05:17 UTC 364d no
etcd-healthcheck-client Mar 25, 2023 05:17 UTC 364d etcd-ca no
etcd-peer Mar 25, 2023 05:17 UTC 364d etcd-ca no
etcd-server Mar 25, 2023 05:17 UTC 364d etcd-ca no
front-proxy-client Mar 25, 2023 05:17 UTC 364d front-proxy-ca no
scheduler.conf Mar 25, 2023 05:17 UTC 364d no
CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Mar 20, 2031 08:20 UTC 8y no
etcd-ca Mar 20, 2031 08:20 UTC 8y no
front-proxy-ca Mar 20, 2031 08:20 UTC 8y no