6.07 Kubernetes Certificates API
π― Why Certificates API?
Manual process does not scale:
- Admin signs CSRs manually using CA key
- Shares signed certificate
- Repeats for renewal
Kubernetes Certificates API allows:
- Submit CSR objects
- Review requests
- Approve or deny
- Automatically sign certificates
- Rotate certificates
π Where is the CA?
CA consists of:
ca.crtca.key
In kubeadm clusters:
Danger
Anyone with access to ca.key can generate cluster admins.
Restrict permissions to 600 and limit access.
π§© Certificates API Flow
π Extract Signed Certificate
Locate:
Decode:
User now has:
jane.keyjane.crt
β Who Signs the Certificate?
The kube-controller-manager performs:
- CSR Approving Controller
- CSR Signing Controller
It requires:
--cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt
--cluster-signing-key-file=/etc/kubernetes/pki/ca.key
Warning
If these flags are missing or incorrect, CSRs remain Pending.
π Important CSR Fields
| Field | Purpose |
|---|---|
| signerName | Certificate type |
| expirationSeconds | Validity duration |
| usages | client auth / server auth |
| request | Base64 CSR data |
Common signerNames:
kubernetes.io/kube-apiserver-clientkubernetes.io/kubelet-servingkubernetes.io/kube-apiserver-client-kubelet
π‘ Production Best Practices
β DO
Success
- Use Certificates API instead of manual signing
- Restrict CSR approval via RBAC
- Monitor CSR creation and approvals
- Use short-lived certificates
- Enable kubelet certificate rotation
- Audit CSR approvals regularly
β DON'T
Danger
- Do NOT auto-approve all CSRs blindly
- Do NOT expose CA private key
- Do NOT grant CSR approve to regular users
- Do NOT ignore Pending CSRs
- Do NOT use long-lived certificates unnecessarily
π¨ Common Production Issues
| Issue | Cause |
|---|---|
| CSR stuck Pending | No approval |
| Approved but no cert | Controller misconfigured |
| TLS handshake failure | Wrong signerName |
| Privilege escalation | Weak CSR RBAC control |
π Certificate Rotation
Certificates expire.
Use:
Or enable automatic kubelet rotation.
Tip
Monitor expiry dates and alert before 30 days.
π― Summary
- Certificates API automates certificate lifecycle
- CSR objects replace manual CA signing
- Controller Manager signs certificates
- Protect CA private key
- Control approvals with RBAC
- Monitor and rotate proactively
Quote
Certificates API enables scalable certificate management β but requires strict approval governance.