How SSL/TLS works · Lesson 6 of 8 · 3 min read
TLS in Kubernetes with cert-manager
cert-manager is the standard Kubernetes controller for certificates: it requests, stores and renews them automatically.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata: { name: letsencrypt-prod }
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]
privateKeySecretRef: { name: letsencrypt-account-key }
solvers:
- dns01:
route53:
region: ap-south-1 # credentials via IRSA on the cert-manager service account
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata: { name: shop-tls, namespace: shop }
spec:
secretName: shop-tls # a kubernetes.io/tls Secret with tls.crt and tls.key
dnsNames: [shop.example.com, "*.shop.example.com"]
issuerRef: { name: letsencrypt-prod, kind: ClusterIssuer }
privateKey: { algorithm: ECDSA, size: 256, rotationPolicy: Always }
renewBefore: 720h # renew 30 days early
- Issuers: ACME (Let's Encrypt), AWS Private CA (aws-privateca-issuer), Vault, self-signed/CA for internal PKI.
- Annotating an Ingress (
cert-manager.io/cluster-issuer: letsencrypt-prod) with atls:section creates the Certificate automatically — the pattern for ingress-nginx. - Secrets of type
kubernetes.io/tlsholdtls.crt(full chain) andtls.key, referenced by Ingresses or mounted into pods. - Apps must reload renewed certificates — Nginx/Envoy/ingress controllers handle it; custom apps may need a file watcher or a rolling restart (Reloader).
- Monitor
certmanager_certificate_expiration_timestamp_secondsandcertmanager_certificate_ready_statusin Prometheus.
Note that with an ALB you'd normally use ACM rather than cert-manager — ALBs can't use Kubernetes Secrets directly. cert-manager shines with NGINX/Envoy ingress, internal mTLS and service certificates.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.