A Certificate Authority Is the Key Everyone Trusts, So a New One Invalidates Every Certificate It Signed

Kubernetes Networking

A certificate authority (CA) is a key pair whose job is to vouch for other keys. It signs certificates, and every party that trusts the CA accepts anything it signed. In Kubernetes, kubeadm creates a private CA when the cluster is born, and every component proves who it is with a certificate from it. That makes the CA the root of all trust in the cluster: keep it, and a rebuilt control plane is the same cluster; lose it and generate a new one, and every certificate in circulation stops working at once.

The Building Blocks

  • Key pair: a private key, kept secret, and a public key, shared freely. What the private key signs, anyone can verify with the public key, and nobody can forge without the private key.
  • Certificate (X.509): a public key plus an identity (a name, and for servers the addresses it may serve), a validity period and the name of its issuer, all signed by the issuer's private key. It says "the issuer vouches that this public key belongs to this name, until this date".
  • CA certificate: the CA's own public key, signed by itself (self-signed). It's what parties install as "trusted" (ca.crt). The matching ca.key is what signs.
  • Verification: to trust a certificate, check its signature with the trusted CA's public key, its dates, and, for a server, that the name or IP you connected to is in it. A certificate signed by any other key fails, however valid it looks.

How Kubernetes Uses It: Mutual TLS

Every connection inside the control plane is TLS in both directions (mutual TLS): the server proves its identity to the client, and the client proves its identity to the server.

Who Certificate Identity it carries
API server serving certificate, signed by the cluster CA its IPs and names: the VIP 192.168.1.50, kubernetes.default, the node IP
Admin (kubeconfig) client certificate embedded in the file user kubernetes-admin, group kubeadm:cluster-admins
Each kubelet client certificate user system:node:<node name>, group system:nodes (see kubeadm Uses the Hostname as the Node Name, So Name a Node Before It Joins)
Controller manager, scheduler client certificates system:kube-controller-manager, system:kube-scheduler
etcd members, and the API server as etcd's client certificates from the separate etcd CA etcd trusts only that CA

For client certificates, the certificate is the login: the API server reads the user from the certificate's common name and the groups from its organization fields, then RBAC decides what they may do.

The CA's public half is everywhere: in every kubeconfig (certificate-authority-data), on every node (/etc/kubernetes/pki/ca.crt), and in every pod (/var/run/secrets/kubernetes.io/serviceaccount/ca.crt), so each of them can check that it's really talking to this cluster's API server.

ServiceAccount tokens follow the same idea without certificates: the API server signs each pod's token (a JWT) with sa.key and checks it with sa.pub. It's how Cilium, CoreDNS and every operator log in to the API.

Why a New CA Invalidates Everything

Picture a passport office that replaces its official stamp: border control now checks for the new stamp, so every passport issued before is worthless, even though the people holding them haven't changed.

If a control plane is rebuilt with kubeadm init and the old /etc/kubernetes/pki isn't put back first, kubeadm generates a new CA and new ServiceAccount keys. The API server now trusts only the new CA, while everything already issued carries the old CA's signature:

  • My kubeconfig on the Mac fails twice. It holds the old ca.crt, so it rejects the API server's new certificate: x509: certificate signed by unknown authority. Even skipping that check, its client certificate is signed by the old CA, so the API server rejects it: Unauthorized.
  • The worker's kubelet (the ROG) is rejected the same way. The node goes NotReady and stays that way until it's reset and joined again with a new token.
  • Every pod's ServiceAccount token was signed with the old sa.key, so the API server rejects them. Controllers, CNI agents and operators can't read or write anything until their pods get new tokens.
  • The restored etcd data still works, but every certificate, kubeconfig and token around it has to be reissued.

Restoring the PKI from the backup bundle before kubeadm init avoids all of this: same CA, same sa.key, so every certificate and token issued before is still valid (see An etcd Snapshot Alone Can't Rebuild a kubeadm Control Plane, So Back Up the PKI with It).

Renewing Certificates Is Different from Replacing the CA

kubeadm's CA is valid for 10 years, the certificates it signs for 1 year. kubeadm certs check-expiration lists them, and kubeadm certs renew (also run by kubeadm upgrade) issues new ones signed by the same CA. Renewal breaks nothing, because trust comes from the CA, not from any one certificate. Only replacing the CA forces everyone to start over.

Why ca.key Is the Most Sensitive File in the Cluster

Whoever holds ca.key can sign a certificate for any name and any group, system:masters included, which RBAC can't restrict. Kubernetes doesn't check revocation lists for client certificates, so a forged certificate can't be cancelled: it works until it expires, and the only full fix is a new CA, with everything above reissued. That's why the backup bundles are 0600, root only, and never go into a repo (see Unix Permissions Grant Read, Write and Execute Separately to the Owner, the Group and Everyone Else).

References

Review cards

Flashcard What makes a component trust a certificate it has never seen before?

It's signed by a CA the component already trusts: the signature checks out with the CA's public key, the dates are valid, and for a server the name matches.

Flashcard Why does a control plane rebuilt with a new CA break every existing kubeconfig?

Their client certificates were signed by the old CA, which the API server no longer trusts, and they hold the old ca.crt, so they reject the server's new certificate too.

Quiz `kubeadm certs renew all` issues new certificates for the control plane. What happens to the kubelets' and admins' existing certificates?
  • They keep working, because the CA that signed them is the same
  • They're revoked and must be reissued
  • They work until the API server restarts
  • Only the admin kubeconfig needs reissuing

Renewal signs new certificates with the same CA. Only replacing the CA invalidates what it signed before.

Flashcard How does the API server know which user and groups a client certificate belongs to?

From the certificate itself: the common name is the user, the organization fields are the groups. RBAC then decides what they may do.

Flashcard Why is a leaked `ca.key` worse than a leaked admin kubeconfig?

With ca.key anyone can sign certificates for any user or group, system:masters included, and Kubernetes can't revoke them. The only full fix is a new CA and reissuing everything.