Kubernetes: x509 certificate has expired or is not yet valid
kubeadm control plane certificates last one year. Renew them, restart the static pods, refresh kubeconfigs, and alert before the next expiry.

Introduction & Quick Summary
kubectl suddenly fails on every command, and nothing was deployed:
Unable to connect to the server: x509: certificate has expired or is not yet valid:
certificate is valid for kubernetes, kubernetes.default, 10.96.0.1, not ...
current time 2026-11-28T10:04:11Z is after 2026-11-14T09:12:40ZQuick answer: the API server's serving certificate — created by kubeadm one year earlier — has passed its expiry date. Renew the control plane certificates, then restart the static pods that hold them in memory, because they were loaded at process start:
sudo kubeadm certs check-expiration # read the dates first
sudo kubeadm certs renew all # writes new files to /etc/kubernetes/pki
# static pod manifests pick the new certificates up only on restart
sudo crictl ps -q --name kube-apiserver | xargs -r sudo crictl stop
sudo mv /etc/kubernetes/manifests/kube-apiserver.yaml /tmp/ && sleep 20
sudo mv /tmp/kube-apiserver.yaml /etc/kubernetes/manifests/kubectl get nodes # verify the API answers again
sudo kubeadm certs check-expiration # all "RESIDUAL TIME" positiveOn a single control plane node that restart is enough. On a multi-node cluster, renew on every control plane node and copy the regenerated kubeconfigs to the clients that use them. This guide covers the layout, the restart order, the kubelet side people forget, and how to make the next expiry an alert.
Core Mechanics, Signatures & Reproducible Setup
kubeadm init writes a PKI tree under /etc/kubernetes/pki and embeds it in the static pod manifests under /etc/kubernetes/manifests. Every leaf certificate is valid for one year; the two CAs are valid for ten.
| Certificate | File | Default lifetime | Renewed by |
|---|---|---|---|
| API server serving | apiserver.crt | 1 year | kubeadm certs renew apiserver |
| API server client | apiserver-kubelet-client.crt | 1 year | renew apiserver-kubelet-client |
| etcd server / peer | etcd/server.crt, etcd/peer.crt | 1 year | renew etcd-server, etcd-peer |
| front proxy client | front-proxy-client.crt | 1 year | renew front-proxy-client |
| admin kubeconfig | admin.conf | 1 year | renew all (regenerates it) |
| controller-manager / scheduler kubeconfigs | controller-manager.conf, scheduler.conf | 1 year | renew all |
| cluster CA | ca.crt, ca.key | 10 years | not renewed by kubeadm |
The expiry is inside the certificate, so the client is the one that notices first. kubectl reads ~/.kube/config, builds a TLS connection, and rejects the server certificate before any authentication happens.
Check the dates before touching anything:
sudo kubeadm certs check-expirationCERTIFICATE EXPIRES RESIDUAL TIME SIGNING CA
admin.conf Nov 14, 2026 09:12 UTC 1w ca
apiserver Nov 14, 2026 09:12 UTC 1w ca
apiserver-kubelet-client Nov 14, 2026 09:12 UTC 1w ca
front-proxy-client Nov 14, 2026 09:12 UTC 1w ca
etcd-server Nov 14, 2026 09:12 UTC 1w caTo inspect a single file directly, openssl prints the same facts and works on any machine that has the certificate:
sudo openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -subject -dates -ext subjectAltNamesubject=CN = kube-apiserver
notBefore=Nov 14 09:12:40 2025 GMT
notAfter=Nov 14 09:12:40 2026 GMT
X509v3 Subject Alternative Name:
DNS:kubernetes, DNS:kubernetes.default, IP Address:10.96.0.1, IP Address:192.168.1.10The SAN list is the other half of this error class: an unexpired certificate is still rejected as "not valid for" a new node IP.
Key Comparison Table
| Message | Cause | Fix |
|---|---|---|
certificate has expired | past notAfter | renew and restart static pods |
certificate is valid for ..., not <name> | SAN missing the address used | regenerate with a kubeadm config listing the SANs |
certificate signed by unknown authority | CA changed or wrong CA bundle | restore the original ca.crt or use the right kubeconfig |
current time ... is before ... | clock skew, not expiry | fix NTP on the node |
x509: certificate is not valid for any names | connecting by raw IP | use the API server name or add the IP to SANs |
| Renewal route | Covers | Requires |
|---|---|---|
kubeadm certs renew all | all control plane leaf certs | root on each control plane node |
kubeadm upgrade | all leaves during an upgrade | a version upgrade |
systemd timer + renew all | everything, unattended | one timer per control plane node |
| kubelet certificate rotation | kubelet client and serving certs | rotateCertificates: true |
manual openssl / cert-manager | external PKI setups | your own PKI process |
| Component | Reads certificates when | Restart needed after renew |
|---|---|---|
| kube-apiserver | process start | yes |
| kube-controller-manager | process start | yes |
| kube-scheduler | process start | yes |
| etcd | process start | yes |
| kubelet | process start, then rotation | only if rotation is disabled |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Renew everything, then restart the right processes
kubeadm certs renew all rewrites files but changes nothing for running processes. Static pods are supervised by the kubelet, which restarts a manifest when its file changes:
sudo kubeadm certs renew all
# touch each manifest to trigger a restart without stopping the API for long
for f in /etc/kubernetes/manifests/*.yaml; do sudo touch "$f"; sleep 5; done
sudo crictl ps --name kube-apiserver # started seconds ago
sudo journalctl -u kubelet -n 30 --no-pagerRestarting while the API is down is safe: the renewed files are already on disk.
2. Kubeconfig files are separate certificates
/etc/kubernetes/admin.conf contains a client certificate with the same one-year lifetime. Renewing the PKI does not update the copy in ~/.kube/config, so kubectl keeps failing with the old certificate:
sudo kubeadm certs renew admin.conf
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
sudo chown "$(id -u):$(id -g)" ~/.kube/config
# or merge just the new client credentials into an existing config
KUBECONFIG=~/.kube/config:/etc/kubernetes/admin.conf kubectl config view --flatten > /tmp/merged
mv /tmp/merged ~/.kube/configEvery user, CI runner and mounted kubeconfig needs the refreshed file.
3. The kubelet side, which fails differently
Kubelet certificates are not control plane certificates. Client certificates issued through the CSR API expire after about a year and are rotated automatically when rotateCertificates is enabled; a node that shows NotReady with kubelet: x509: certificate has expired needs either rotation or a manual reissue:
# /var/lib/kubelet/config.yaml
rotateCertificates: true
serverTLSBootstrap: truesudo systemctl restart kubelet
sudo journalctl -u kubelet -n 50 --no-pager | grep -i -e cert -e rotate
kubectl get csr # pending requests from the node
kubectl certificate approve <csr-name>If the node cannot authenticate at all, kubeadm kubeconfig user --org system:nodes --client-name system:node:<node> generates a fresh client certificate from the CA on a control plane node.
4. When the CA itself expired
Ten years is long, but it does happen in long-lived labs, and no renewal command can fix it: every certificate signed by that CA must be reissued, and the kubeconfigs of every client replaced.
sudo openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -dates
# notAfter=... 2026 GMT <- if this is past, the cluster certificates cannot be renewed in placeThe supported path is a new control plane with kubeadm init (optionally reusing etcd data) and nodes rejoining. Plan it as a migration, not a repair.
5. Make the next expiry an alert
A gauge from the certificate file turns expiry into a monitoring problem instead of an outage:
#!/usr/bin/env bash
# prints days left for the API server certificate
end=$(date -d "$(openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -enddate | cut -d= -f2)" +%s)
echo "kube_apiserver_cert_days_left $(( (end - $(date +%s)) / 86400 ))"Alert below 30 days and schedule kubeadm certs renew all with a systemd timer at 60, followed by a manifest touch. Keeping the timer and the alert separate means a failed renewal still pages someone. Comparing an old and a new kubeconfig while debugging the client side is easier with the text diff tool, and checking the endpoint and its certificate by hand is quicker with the curl command generator:
curl -vk https://192.168.1.10:6443/healthz 2>&1 | grep -E "subject:|expire|issuer:"Common Compilation/Runtime Mistakes & Version Gotchas
- Renewing without restarting. New files on disk, old certificates in memory; nothing changes until the static pod restarts.
- Updating only
admin.conf. Every kubeconfig file carries its own client certificate and expires on the same schedule. - Renewing on one control plane node. Each node has its own PKI copy; renew on all of them, and keep the same CA everywhere.
- Deleting the CA while "starting fresh". A new
ca.crtinvalidates every existing kubeconfig, kubelet certificate, and service account token signer at once. - Treating
not yet validas expiry. It is a clock problem (NTP, a restored VM snapshot), so checktimedatectlandchronyc trackingbefore renewing anything. - Version notes.
kubeadm certs renew allhas been stable since 1.15 and replaced the olderkubeadm alpha certs renew;kubeadm upgraderenews all leaf certificates as part of the upgrade, so clusters upgraded at least yearly never see this error. Since 1.15 the kubelet rotates client certificates by default when the CSR API is reachable, which is why control plane certificates, not kubelet ones, are the usual expiry surprise.
Official documentation: kubeadm certificate management and Certificates and certificate signing requests.
Official references
primary documentationThe Kubernetes documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Kubernetes work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Kubernetes guides
All Kubernetes guidesKubernetes 1.35: kubelet will not start on a cgroup v1 node
A 1.35 kubelet refuses a cgroup v1 host, and the removed pod-infra flag stops custom images. Check the kernel command line before the node pool.
kubectl: metadata.resourceVersion: Invalid value: 0x0
The 0x0 error means an update carried no resourceVersion. Switch to apply or patch, or read the live object first, and keep versions out of Git.
no matches for kind in version: removed APIs and missing CRDs
kubectl cannot map the manifest to an endpoint. Either the API version was removed or the CRD is absent, and discovery tells you which.
kubectl apply: metadata.annotations: Too long: must have at most 262144 bytes
Client-side apply copies the manifest into an annotation. Use server-side apply, remove the legacy annotation, and resolve field conflicts once.
More in Kubernetes
All Kubernetes guidesThe guides filed next to this one in Kubernetes, in library order.