Skip to main content

kubeadm certs renew Without a Static Pod Restart Leaves etcd and the API Server on Expiring Certificates

High severityKubernetes About 20 minutes to fix

Overview

check-expiration shows a year left, yet the control plane still fails on the old date. The Pods were never restarted after the renewal.

At a glance

Symptom
A cluster renewed weeks ago fails on the original expiry date as if the renewal never happened.
Likely cause
The kubeadm documentation states it plainly: after running kubeadm certs renew, you should restart the control plane Pods, because dynamic certificate reload is currently…
Impact
etcd sits behind certificate checks on both of its ports.
Verification signal
Every control plane Pod should have started after the renewal, and every node should report the new dates.
Safe correction
Renew on every control plane node, then recreate the static Pods on one node at a time, checking etcd before moving on.
Rollback or recovery
Every step can be undone while the old certificates are still inside their validity period.

Renewing kubeadm certificates before they expire is a routine job, and kubeadm certs renew all reports success in seconds. If nobody then restarts the control plane Pods, the etcd and API server processes can carry on with the certificates they loaded at start, and the old expiry date still arrives.

The renewal only writes new files. Kubernetes documents that dynamic certificate reload is not supported for every component and certificate, so the control plane Pods must be restarted before the renewal is complete. On a cluster with more than one control plane node, the renewal also has to run on every one of them. The fix is to renew on each node, then recreate its static Pods one node at a time.

Symptom

A cluster renewed weeks ago fails on the original expiry date as if the renewal never happened. Before that date nothing looks wrong. kubeadm certs check-expiration shows close to a year of residual time for apiserver-etcd-client, etcd-server, etcd-peer and the rest, and the change ticket was closed on that evidence.

On the day, the processes still presenting the old certificates have their TLS connections refused, and the API server’s link to etcd is one of them. kubectl requests start failing, and controllers stop making progress. A second version of the same trap appears on clusters with several control plane nodes. The renewal ran on cp-1 only, so cp-2 and cp-3 still hold the old files as well as the old processes.

Why a finished renewal looks safe

Every check people normally run reads files on disk. kubeadm certs check-expiration reports the certificates in /etc/kubernetes/pki and the client certificates embedded in admin.conf, controller-manager.conf and scheduler.conf. After a renewal those files really are new. The running etcd and kube-apiserver Pods were never asked to read them, and nothing in the command’s output says so.

Root cause

The kubeadm documentation states it plainly: after running kubeadm certs renew, you should restart the control plane Pods, because dynamic certificate reload is currently not supported for all components and certificates. Until a component’s Pod is recreated, its renewal cannot complete.

Those Pods are static Pods, run by each node’s kubelet rather than by the API server. So kubectl delete pod does not restart them. The documented method is to move the manifest out of /etc/kubernetes/manifests/, wait 20 seconds (the kubelet’s fileCheckFrequency), then move it back. The command also only renews certificates on the node where it runs, which is why a replicated control plane needs it on every control plane node.

Impact

etcd sits behind certificate checks on both of its ports. The API server proves itself to etcd with apiserver-etcd-client, the members prove themselves to each other with etcd-peer, and etcd presents etcd-server to every client. When a certificate still in use passes its expiry date, the connection it protects fails. If every node was built or last renewed on the same day, the whole control plane can stop at once.

Running Pods usually keep serving traffic, but nothing new can be scheduled or changed while the API server cannot reach etcd. Recovering under that pressure is where the risky shortcuts below get taken.

How to confirm the Pods never picked up the renewal

Three read-only checks settle it. First, run this on every control plane node, because each node keeps its own certificate files:

sudo kubeadm certs check-expiration

A node still showing a short residual time was never renewed. Next, note when the renewal ran. The renewed certificate’s start date is a close guide:

sudo openssl x509 -noout -startdate -in /etc/kubernetes/pki/apiserver-etcd-client.crt

Finally, list when each control plane Pod started:

kubectl -n kube-system get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'

Any etcd-, kube-apiserver-, kube-controller-manager- or kube-scheduler- Pod that started before the renewal has not been recreated since, so it has not completed the renewal.

Switching off certificate checks makes it worse

When the API server cannot reach etcd, the tempting fix is to loosen etcd itself: drop --client-cert-auth=true so the API server can connect without a valid client certificate. The Kubernetes documentation describes access to etcd as equivalent to root permission in the cluster. Client certificate checking is what restricts that access to the API servers, and removing it opens the cluster’s whole data store to anything that can reach port 2379.

The kubectl side has its own shortcut, insecure-skip-tls-verify, which kubectl’s reference says makes HTTPS connections insecure. It stops the client checking the server’s certificate and does nothing for the API server’s link to etcd. Rebooting every control plane node at once is the third mistake: etcd stays available only while most of its members are up, so restart one node at a time.

Correction

Renew on every control plane node, then recreate the static Pods on one node at a time, checking etcd before moving on. Work well before the old expiry date, so each step can be undone while the old certificates are still valid. On a cluster with a single control plane node, the API is unavailable while its Pods restart, so book a maintenance window.

  1. Back up first. On each node, copy /etc/kubernetes/pki and the kubeconfig files in /etc/kubernetes to a root-only directory such as /etc/kubernetes/backup/. Never keep backups in the manifests directory, because the kubelet reads every file there. Take an etcd snapshot with ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /var/backups/etcd-pre-restart.db. Check it with etcdutl --write-out=table snapshot status /var/backups/etcd-pre-restart.db, then encrypt it.
  2. Renew where it is missing. On any node whose check still shows the old dates, run sudo kubeadm certs renew all. Precondition: the CA files in /etc/kubernetes/pki are present, because kubeadm signs with them; it cannot renew certificates from an external CA. Rollback: restore that node’s backed-up pki directory and kubeconfig files.
  3. Recreate the static Pods on one node. Move etcd.yaml, kube-apiserver.yaml, kube-controller-manager.yaml and kube-scheduler.yaml from /etc/kubernetes/manifests/ to a holding directory outside it. Wait at least 20 seconds for the kubelet to stop them, then move them back. Rollback: if a Pod does not return, put back that node’s backed-up certificate files and move the manifests in again.
  4. Check before the next node. Wait until that node’s Pods show a new start time, then run ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key member list. Every member should be listed. Only then repeat step 3 on the next node.
  5. Refresh copied admin credentials. Where admin.conf was copied to $HOME/.kube/config, run sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config and sudo chown $(id -u):$(id -g) $HOME/.kube/config, as the kubeadm guide shows.

Following along? Tap a step’s number to tick it off.

Verification

Every control plane Pod should have started after the renewal, and every node should report the new dates. Run the jsonpath listing again and compare each start time with the renewed certificate’s start date. Run sudo kubeadm certs check-expiration on every control plane node, and the etcdctl member list check once more. Finally, run a kubectl command with each user’s refreshed kubeconfig.

Rollback

Every step can be undone while the old certificates are still inside their validity period. Restore that node’s backed-up /etc/kubernetes/pki directory and kubeconfig files, then recreate its static Pods the same way, one node at a time. Once the old certificates have expired, rolling back to them will not help, so the safe direction is forward. In that case, finish the renewal and the restarts.

The etcd snapshot is for the worst case only. Restoring it rewinds the cluster’s state to the moment it was taken, so use it only if etcd data is damaged, not to undo a certificate change.

Stop it happening at the next renewal

  • Make the restart part of the renewal. A renewal ticket closes only when every control plane Pod’s start time is later than the renewal, on every node.
  • kubeadm renews all certificates during a control plane upgrade. Clusters upgraded at least once a year, as kubeadm assumes, rarely reach a manual renewal at all.
  • Alert on residual time from kubeadm certs check-expiration on every node, not just the first. Track the oldest control plane Pod’s age too, because the files alone can mislead.
  • Keep etcd’s other protections in place while you work. Peer traffic needs its own certificate checks, as described in the etcd peer authentication flag on port 2380, and etcd’s backup proxy port can bypass API server access control.
3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

kubeadm certs renew all
kubeadm certs check-expiration
apiserver-etcd-client
4

When to escalate

Validation and rollback are covered in the sections above.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

More from KBY that goes with this config trap.

Discover more

Connected KBY resources