Interview Prep/Kubernetes/Cluster operations: certs, drains, rollouts and quotas

Every `kubectl` command on a kubeadm cluster fails with `Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2026-03-14T09:12:44Z is after 2026-03-13T08:01:10Z`.

AdvancedTroubleshootingCluster operations: certs, drains, rollouts and quotas
Answer

Likely causes → The kubeadm-generated certificates (API server, front-proxy, etcd clients, admin.conf) expired after one year because the cluster was never upgraded (kubeadm renews certs on kubeadm upgrade apply) and nobody renewed them.

Diagnose →

sudo kubeadm certs check-expiration
sudo openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -enddate

Fix → On each control-plane node:

sudo kubeadm certs renew all
# Restart static Pods so they load new certs
sudo mkdir -p /tmp/manifests && sudo mv /etc/kubernetes/manifests/*.yaml /tmp/manifests/
sleep 20 && sudo mv /tmp/manifests/*.yaml /etc/kubernetes/manifests/
sudo cp /etc/kubernetes/admin.conf ~/.kube/config

Check that kubelet client certs are rotating (/var/lib/kubelet/pki/kubelet-client-current.pem) and redistribute any kubeconfigs built from the old admin cert.

Prevent → Upgrade at least yearly, alert on certificate expiry (30 days), and keep the renewal runbook tested.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Cluster operations: certs, drains, rollouts and quotas