Skip to main content
Security & multi-tenancyLesson 6 of 13

Automatic TLS Certificates with cert-manager

Follow one certificate from request to renewal: ClusterIssuer → Certificate → CertificateRequest → Order → Challenge → Secret. See how the CA checks that you control the domain, and which resource to read when issuance gets stuck.

Issuer—
Certificate—
Challenge—
Expires—
Kubernetes clusterIngressshop.example.comNo certCertificatesecretName shop-tlsCertificateRequestCSRClusterIssuerACME · solverscert-managerControllerOrderOne per requestSecrettls.crt · tls.keySolver PodHTTP-01 tokenChallengeOne per nameLet's EncryptACME CADNS providerexample.com zone
RequestResponse / reportWatchAppears in a later step

What you will learn

  • An Issuer says which CA to use and how to prove domain control
  • The chain Certificate → CertificateRequest → Order → Challenge
  • HTTP-01 through a temporary solver, and why it gets stuck pending
  • DNS-01 with a TXT record, required for wildcard names
  • Renewal timing, rate limits and the staging server

Where to look when a certificate is stuck​

Read the chain from top to bottom and stop at the first resource that is not ready or valid.

ResourceCreated byWhat to checkTypical reason it is stuck
ClusterIssuer / IssuerYouReady conditionWrong ACME URL, missing account key Secret, bad DNS provider credentials
CertificateYou, or ingress-shim from an annotationReady and Issuing conditions, status.renewalTimeIssuer name or kind wrong in issuerRef, names not covered by any solver
CertificateRequestcert-manager, one per attemptReady, Approved, DeniedIssuer not ready, request not approved
OrderACME issuer, one per requeststate: pending, valid, invalid, erroredA Challenge failed, or a rate limit was hit
ChallengeACME issuer, one per namestate and reasonDNS points elsewhere, port 80 blocked, TXT record not visible yet
Secretcert-managertls.crt subject and expiryNot created until the Certificate is Ready

If a Certificate shows Ready=True but browsers still see the old certificate, check that the Ingress or Gateway really names the same Secret, in the same namespace.

Try it yourself​

kubectl get clusterissuer # READY per issuer
kubectl describe clusterissuer letsencrypt-prod # ACME URL, account status
kubectl get certificate,certificaterequest,order,challenge -A # The whole chain at once
kubectl describe certificate shop-tls -n shop # Conditions and events
kubectl describe challenge -n shop # State, reason, self-check errors
cmctl status certificate shop-tls -n shop # Certificate, request, order and challenges in one view
cmctl renew shop-tls -n shop # Force a renewal now
curl -v http://shop.example.com/.well-known/acme-challenge/test # Is port 80 reachable from outside?
dig TXT _acme-challenge.example.com +short # Is the DNS-01 record visible?
kubectl get secret shop-tls -n shop -o jsonpath='{.data.tls\.crt}' \
| base64 -d | openssl x509 -noout -subject -enddate # Names and expiry of the issued cert

Check yourself

  1. A Certificate stays Ready=False and Secret shop-tls is never created. Where should you look first?
  2. An HTTP-01 Challenge is stuck pending with Waiting for HTTP-01 challenge propagation. The site only serves HTTPS. What is the most likely cause?
  3. You need a certificate for *.example.com from Let's Encrypt. Which challenge type do you need?

Further reading: cert-manager docs · ACME issuer · Securing Ingress resources · Troubleshooting ACME · Let's Encrypt challenge types · Let's Encrypt rate limits · Staging environment · HTTPS and Certificates · Ingress Rules and TLS