Skip to main content
Kubernetes internalsLesson 7 of 12

Cluster Certificate Expiry

A cluster that ran fine for over a year suddenly stops answering kubectl one morning. A classic cause is certificate expiry. Let's follow how expiry creeps up silently and how to recover.

Validity left (example)365 days
kubectl accessOK
Node statusReady
Control planeWorker nodeAdminkubectlAPI serverentry for all requestsControllersincl. scheduleretcdstate storeCert filescerts and keyskubeletnode agentExpiry alertmetrics · alertsPresent certStatus reportWrite
RequestResponse / reportWatchAppears in a later step

What you will learn

  • Components verify each other with certificates
  • Why expiry hits at the exact moment, without warning
  • Which expired certificate causes which symptom
  • Why you must restart after renewing

Working back from the symptom​

SymptomCertificate to suspectWhat to check
kubectl fails with an x509 or expiry errorAPI server certificate, admin kubeconfigExpiry list (kubeadm certs check-expiration on kubeadm clusters)
API server is up but every read and change failsetcd certificateetcd connection errors in the API server log
Only one node turns NotReadyThat node's kubelet certificateThe node's kubelet log
Renewed, but the symptom remainsComponents still hold the old certificateWhether control plane components were restarted

Upgrade order and node replacement continue in Draining Nodes and Upgrading the Cluster.

Try it yourself​

sudo kubeadm certs check-expiration # Expiry date of each certificate
sudo openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -enddate # API server certificate file
kubectl config view --raw -o jsonpath='{.users[0].user.client-certificate-data}' | base64 -d | openssl x509 -noout -enddate # Your kubeconfig certificate
sudo openssl x509 -in /var/lib/kubelet/pki/kubelet-client-current.pem -noout -enddate # kubelet client certificate (on a node)
echo | openssl s_client -connect <api-server>:6443 2>/dev/null | openssl x509 -noout -dates # What the running API server serves (restarted?)

Check yourself

  1. A cluster that ran fine for over a year suddenly fails kubectl with certificate has expired (x509). Why was there no earlier warning?
  2. You ran kubeadm certs renew, but kubectl still fails with the same expiry error. What was most likely missed?
  3. Only one node turns NotReady while the rest of the cluster works. Which certificate should you suspect?

Further reading: Certificate management with kubeadm · PKI certificates and requirements · cert-manager