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
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
| Symptom | Certificate to suspect | What to check |
|---|---|---|
| kubectl fails with an x509 or expiry error | API server certificate, admin kubeconfig | Expiry list (kubeadm certs check-expiration on kubeadm clusters) |
| API server is up but every read and change fails | etcd certificate | etcd connection errors in the API server log |
| Only one node turns NotReady | That node's kubelet certificate | The node's kubelet log |
| Renewed, but the symptom remains | Components still hold the old certificate | Whether 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
Further reading: Certificate management with kubeadm · PKI certificates and requirements · cert-manager