Skip to content

cert-manager — issuing TLS certificates with Let's Encrypt

Install cert-manager, configure ClusterIssuer with HTTP-01 and DNS-01, and get automatic renewals for ingress certificates without manual intervention.

cert-manager is a Kubernetes controller that issues, renews, and rotates X.509 certificates. With Let’s Encrypt as the issuer, it gives ingress controllers automatic TLS without anyone running certbot. This article covers the install via Helm, the difference between HTTP-01 and DNS-01 challenges, a working ClusterIssuer, wildcard certs via DNS-01, and the debug commands when an issuance is stuck.

How to verify

The controller is healthy and the issuers are ready:

kubectl -n cert-manager get pods
kubectl get clusterissuer
kubectl describe clusterissuer letsencrypt-prod

get clusterissuer should show READY: True. describe exposes the ACME account status and any registration error. For a specific Certificate object:

kubectl get certificate -A
kubectl describe certificate web-tls -n team-payments
kubectl get challenges -A

The Certificate’s events explain every step of the ACME exchange. challenges shows pending challenges with the validation URL — the most common debugging surface.

What’s happening

cert-manager runs three controllers: one for Issuer/ClusterIssuer (account registration with the CA), one for Certificate (the desired state — “I want a cert for these hostnames in this Secret”), and one for CertificateRequest/Order/Challenge (the actual ACME work). When you create a Certificate, cert-manager creates a CertificateRequest, which creates an Order, which creates one Challenge per hostname. Each Challenge runs the chosen validation method (HTTP-01 or DNS-01), and on success cert-manager writes the issued cert to the named Secret.

HTTP-01 is the default: cert-manager spins up a temporary Pod and Ingress (or modifies the existing one) so Let’s Encrypt can fetch http://<host>/.well-known/acme-challenge/<token>. It works for any hostname pointed at the cluster, but cannot issue wildcards. DNS-01 puts a TXT record under the domain (using your DNS provider’s API); it can issue wildcards and works for hosts not yet exposed via HTTP, but requires DNS API credentials in a Secret.

The Certificate object is the typical entry point, but the more common pattern is the cert-manager Ingress annotation: cert-manager.io/cluster-issuer: letsencrypt-prod. The ingress-shim controller watches Ingresses with that annotation and creates the Certificate for you.

Let’s Encrypt has separate staging and production environments. Always test with staging first (acme-staging-v02.api.letsencrypt.org) — production has tight rate limits (5 duplicate certs per week per identical name set), and a typo in your config can lock you out for a week.

The procedure

  1. Install cert-manager via Helm with CRDs included. Pin the chart version.

    helm repo add jetstack https://charts.jetstack.io
    helm repo update
    helm install cert-manager jetstack/cert-manager \
      --namespace cert-manager --create-namespace \
      --version v1.14.5 \
      --set installCRDs=true \
      --set prometheus.enabled=true
  2. Create a staging ClusterIssuer first. Always validate the wiring against staging before production.

    apiVersion: cert-manager.io/v1
    kind: ClusterIssuer
    metadata: { name: letsencrypt-staging }
    spec:
      acme:
        server: https://acme-staging-v02.api.letsencrypt.org/directory
        email: ops@example.com
        privateKeySecretRef: { name: letsencrypt-staging-account-key }
        solvers:
          - http01:
              ingress: { class: nginx }
  3. Test with a staging-issued cert. Annotate an Ingress and watch:

    metadata:
      annotations:
        cert-manager.io/cluster-issuer: letsencrypt-staging
        acme.cert-manager.io/http01-edit-in-place: "true"
    spec:
      tls:
        - hosts: [app.example.com]
          secretName: app-example-com-tls
    kubectl describe certificate app-example-com-tls -n team-payments
    kubectl get order,challenge -n team-payments

    Once you see a cert issued (with the Fake LE Root CA), repeat with the production issuer.

  4. Create the production ClusterIssuer:

    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-key }
        solvers:
          - http01:
              ingress: { class: nginx }
  5. Issue a wildcard via DNS-01 (Route53 example). You need an IAM user with route53:ChangeResourceRecordSets on the hosted zone:

    apiVersion: cert-manager.io/v1
    kind: ClusterIssuer
    metadata: { name: letsencrypt-prod-dns }
    spec:
      acme:
        server: https://acme-v02.api.letsencrypt.org/directory
        email: ops@example.com
        privateKeySecretRef: { name: letsencrypt-prod-dns-key }
        solvers:
          - dns01:
              route53:
                region: us-east-1
                hostedZoneID: Z3ABCDEFGH123
                accessKeyID: AKIAxxxx
                secretAccessKeySecretRef:
                  name: route53-creds
                  key: secret-access-key
    ---
    apiVersion: cert-manager.io/v1
    kind: Certificate
    metadata: { name: wildcard-example-com, namespace: team-payments }
    spec:
      secretName: wildcard-example-com-tls
      issuerRef:
        name: letsencrypt-prod-dns
        kind: ClusterIssuer
      commonName: "*.example.com"
      dnsNames:
        - "example.com"
        - "*.example.com"
  6. Watch a renewal happen ahead of time — cert-manager renews at 2/3 of the cert’s lifetime by default (60 days for a 90-day Let’s Encrypt cert):

    kubectl get certificate -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,READY:.status.conditions[0].status,EXPIRES:.status.notAfter
  7. Force a renewal when you need one outside the schedule (e.g. after a key rotation):

    kubectl cert-manager renew web-tls -n team-payments

Common pitfalls

  • HTTP-01 challenges fail if the hostname doesn’t resolve to the cluster — host -t A app.example.com should match the ingress LB. CDNs in front of the ingress can also intercept the challenge path.
  • DNS-01 propagation delay sometimes makes the challenge fail and retry — cert-manager polls the resolver listed in dns01.recursiveNameservers; on broken networks, point this at 1.1.1.1:53,8.8.8.8:53.
  • Hitting the production rate limit (5 identical-cert issuances per week) means you wait until the window expires; develop against staging.
  • An Ingress with multiple hosts produces one cert with multiple SANs unless you split it — that’s usually what you want, but verify tls.hosts covers every host on spec.rules.
  • cert-manager won’t delete the issued Secret when you delete the Certificate unless you set revisionHistoryLimit on the Certificate; orphaned kubernetes.io/tls Secrets accumulate.

We operate cert-manager for clients with staging-first validation, prod DNS-01 for wildcards, monitoring that flags certs within 30 days of expiry, and an ACME account stored outside the cluster so rotation across cluster rebuilds doesn’t burn renewal limits. See /en/services/managed-operations/.