Skip to content

x509: certificate has expired or is not yet valid

A TLS certificate is outside its validity period from the point of view of the machine checking it. Either it really expired, or a clock is wrong.

  1. “Not yet valid” on a new certificate almost always means clock skew. Check time sync (timedatectl, chrony) on the client and the server.
  2. On kubeadm control plane nodes, check every component certificate: kubeadm certs check-expiration.
  3. Check a served certificate directly: openssl s_client -connect <host>:6443 </dev/null 2>/dev/null | openssl x509 -noout -dates.
  4. For kubelets, look for certificate errors in journalctl -u kubelet. Kubelet client certificates rotate automatically when rotation is enabled, but only while the node can still reach the API server.

Fix on kubeadm (take an etcd snapshot first)

Section titled “Fix on kubeadm (take an etcd snapshot first)”
Terminal window
kubeadm certs renew all
# Restart the control plane static pods so they load the new certificates,
# for example by moving their manifests out of /etc/kubernetes/manifests and back.

Then refresh your own kubeconfig (it embeds a client certificate from admin.conf). Managed platforms rotate control plane certificates themselves; on OpenShift, certificate rotation is automatic but can stall on clusters that were shut down for a long time, and Red Hat documents a recovery procedure for that case.

kubeadm certificates last one year and are renewed by kubeadm upgrade, so regular upgrades prevent this entirely. Alert on certificate expiry at 30 days.

Read next: Control plane failures.