Skip to main content
RunBook Academy

KubernetesCXIV · Certificate and TLS OperationsCertificate and TLS operations

cert-manager — Kubernetes-native certificate management

Advanced⏱ ~17 minkubectlcert-manager

What you'll learn

  • Use cert-manager to issue and renew certificates
  • Configure ACME issuers (Let's Encrypt)
  • Configure internal CA and Vault PKI issuers
  • Apply the operational discipline of certificate management

Prerequisites

Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16

Not yet marked complete on this device.

cert-manager is the standard for Kubernetes certificate management. This lesson walks the framework, the ACME integration, the internal CA, Vault PKI, and the operational discipline.

The cert-manager architecture

flowchart LR
    A[cert-manager controller] --> B["Issuer / ClusterIssuer"]
    A --> C[Certificate]
    A --> D[Secret with TLS material]
    B -->|ACME| E[Let's Encrypt]
    B -->|CA| F["Internal CA / Vault PKI"]
    B -->|Self-signed| G[Test only]
    C -->|requested| A
    A -->|issues| B
    A -->|stores in| D

The components:

  • cert-manager controller. Deployment that watches Certificate CRs and reconciles them.
  • Issuer / ClusterIssuer. Defines the CA (ACME, internal, Vault, self-signed).
  • Certificate. Declares a desired certificate.
  • Secret. Stores the TLS material (cert, key, CA).

The controller issues certificates when a Certificate is created and renews them before expiry.

An ACME issuer (Let’s Encrypt)

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: ops@example.com
    privateKeySecretRef:
      name: letsencrypt-prod-account
    solvers:
      - http01:
          ingress:
            class: nginx
      - dns01:
        route53:
          region: us-east-1
          accessKeyIDSecretRef:
            name: aws-credentials
            key: access-key-id
          secretAccessKeySecretRef:
            name: aws-credentials
            key: secret-access-key

The ACME issuer:

  • server. The ACME server URL (Let’s Encrypt production).
  • email. Contact for the ACME account.
  • privateKeySecretRef. The Secret that stores the ACME account key.
  • solvers. The challenge solvers (http-01 for Ingress, dns-01 for DNS).

An internal CA issuer

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: internal-ca
  namespace: prod-app
spec:
  ca:
    secretName: internal-ca-key-pair

The internal CA issuer:

  • ca. The Secret containing the CA’s certificate and private key.
  • cert-manager signs the issued certificate with the CA.

The CA can be generated by cfssl, easyrsa, openssl, or cert-manager itself with the cert-manager.io/issuer-ca annotation.

A Vault PKI issuer

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: vault-pki
  namespace: prod-app
spec:
  vault:
    server: https://vault.example.com
    path: pki/sign/prod-app
    auth:
      kubernetes:
        role: cert-manager
        mountPath: /v1/auth/kubernetes
        secretRef:
          name: vault-token
          key: token

The Vault PKI issuer:

  • server. Vault URL.
  • path. The PKI secrets engine path.
  • auth.kubernetes. Vault authenticates via Kubernetes ServiceAccount; cert-manager presents a token.

Vault PKI is the enterprise choice for managed PKI with audit trail.

A Certificate request

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: myapp-cert
  namespace: prod-app
spec:
  secretName: myapp-tls
  dnsNames:
    - myapp.example.com
    - myapp.prod-app.svc.cluster.local
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  duration: 2160h  # 90 days
  renewBefore: 720h  # renew 30 days before expiry

The Certificate:

  • secretName. The Secret to store the TLS material.
  • dnsNames. The SANs (Subject Alternative Names).
  • issuerRef. The Issuer or ClusterIssuer to use.
  • duration. The validity period (default 90 days).
  • renewBefore. How long before expiry to renew (default 30 days).

cert-manager issues the certificate, stores it in the Secret, and renews it before expiry.

The certificate lifecycle

flowchart LR
    A[Certificate CRD created] --> B[cert-manager resolves]
    B --> C[Issue via Issuer]
    C --> D[Store in Secret]
    D --> E["Renewal check: 30 days before"]
    E -->|expiring| C
    E -->|not expiring| F[Done]

The lifecycle:

  1. The Certificate CR is created.
  2. cert-manager resolves the Issuer and creates a CertificateRequest.
  3. The Issuer signs the certificate (via ACME, CA, Vault).
  4. cert-manager stores the certificate in the Secret.
  5. cert-manager monitors the certificate’s expiry.
  6. Before renewBefore, cert-manager renews the certificate.

Quiz

Knowledge check · 4 questions

  1. Q1. What does cert-manager create when a Certificate resource is reconciled?

  2. Q2. An application that loads its certificate at startup picks up a cert-manager renewal automatically.

  3. Q3. Resolve a Certificate that never becomes ready because its issuer reference is wrong.

    A Certificate named myapp-cert in namespace prod-app requests myapp.example.com and names `issuerRef: name: letsencrypt-prod, kind: Issuer`. Twenty minutes later `kubectl get certificate -n prod-app` shows READY False and SECRET myapp-tls with no data. The cluster has a ClusterIssuer called letsencrypt-prod and no namespaced Issuer of that name anywhere.

  4. Q4. Name the chain of resources cert-manager creates from a Certificate to a signed certificate when using an ACME issuer, and say where the result is stored.

Passing score: 75%. Answers are checked in this browser.

The operational discipline

cert-manager in production rests on five non-negotiable elements:

  • Install cert-manager before any Ingress. TLS is automatic.
  • Use the right issuer. ACME for public certs; internal CA or Vault for private.
  • Set sensible renewal. 30 days before expiry is a good default.
  • Monitor certificate expiry. Alert on certificates expiring soon.
  • Document the issuer setup. The runbook lists which issuer serves which namespace.

cert-manager is production TLS management. The discipline is to install, configure, and monitor.