`kubectl` against a kubeadm cluster fails with `Unable to connect to the server: x509: certificate has expired or is not yet valid`
AdvancedTroubleshootingCertificates, TLS and security incident response
Answer
Likely causes → kubeadm-issued control-plane certificates last one year. They are renewed automatically only during kubeadm upgrade, and this cluster was not upgraded for a year.
Diagnose →
sudo kubeadm certs check-expiration
Fix → On each control-plane node:
sudo kubeadm certs renew all
# restart static pods: move manifests out and back
sudo mkdir -p /tmp/m && sudo mv /etc/kubernetes/manifests/*.yaml /tmp/m/ && sleep 20 && sudo mv /tmp/m/*.yaml /etc/kubernetes/manifests/
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
Check that kubelet client certificate rotation is on (rotateCertificates: true).
Prevent → Upgrade at least yearly, and alert on kubeadm certs check-expiration (or apiserver_client_certificate_expiration_seconds) at 30 days.
More on Certificates, TLS and security incident response
A cert-manager Certificate stays `Ready=False` and the Challenge shows `Waiting for HTTP-01 challenge propagation: wrong status code '404', expected '200'`IntermediateA DNS-01 challenge hangs forever with `DNS record for "acme.com" not yet propagated`, although `dig` from your laptop shows the TXT recordAdvancedIssuance fails with `429 urn:ietf:params:acme:error:rateLimited: too many certificates already issued`BeginnerA service calling another internal service fails with `x509: certificate signed by unknown authority`BeginnerAt 05:30 every client starts failing with `x509: certificate has expired or is not yet valid`BeginnerBrowsers load `https://api.acme.com` fine, but `curl` and Java clients fail with `unable to get local issuer certificate`Intermediate