TLS Certificate Automation with cert-manager
Automated TLS Certificate Issuance (cert-manager)
Section titled āAutomated TLS Certificate Issuance (cert-manager)āWeāll also cover how cert-manager is used to issue certificates for Ingress inside AKS.
Managing cert-manager for AKS
Section titled āManaging cert-manager for AKSāWe designed cert-manager to be installed at the cluster level, managed via Argo CD Init as a cluster-wide utility.
Once deployed, cert-manager is used to configure a Letās Encrypt Issuer as a ClusterIssuer.

Issuing and using a certificate
Section titled āIssuing and using a certificateāIssuing and using a certificate for an Ingress means referencing the ClusterIssuer configured above.
apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: argocd-apps-server annotations: cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/backend-protocol: HTTP nginx.ingress.kubernetes.io/force-ssl-redirect: "false"spec: ingressClassName: webapprouting.kubernetes.azure.com rules: - host: a.b.example.net http: paths: - pathType: Prefix path: "/" backend: service: name: a-service port: number: 80 tls: - hosts: - a.b.example.net secretName: a.b-letsencrypt-prodInstalling cert-manager
Section titled āInstalling cert-managerāYou can follow the standard kubectl apply approach from the cert-manager docs.
We used the manifest at https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml.
Creating a Letās Encrypt ClusterIssuer
Letās Encrypt provides two Issuer flavors (Prod and Staging) and the Staging one produces an āunsafe siteā warning.
# Prod issuerapiVersion: cert-manager.io/v1kind: ClusterIssuermetadata: name: letsencrypt-prod namespace: cert-managerspec: acme: # The ACME server URL server: https://acme-v02.api.letsencrypt.org/directory # Email address used for ACME registration email: admin@example.com # Name of a secret used to store the ACME account private key privateKeySecretRef: name: letsencrypt-prod # Enable the HTTP-01 challenge provider solvers: - http01: ingress: ingressClassName: webapprouting.kubernetes.azure.com---# Staging IssuerapiVersion: cert-manager.io/v1kind: ClusterIssuermetadata: name: letsencrypt-staging namespace: cert-managerspec: acme: # The ACME server URL server: https://acme-staging-v02.api.letsencrypt.org/directory # Email address used for ACME registration email: admin@example.com # Name of a secret used to store the ACME account private key privateKeySecretRef: name: letsencrypt-staging # Enable the HTTP-01 challenge provider solvers: - http01: ingress: ingressClassName: webapprouting.kubernetes.azure.comExample Ingress configuration
apiVersion: v1kind: Namespacemetadata: name: sample-test
---apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: store-front namespace: sample-test annotations: kubernetes.io/ingress.class: webapprouting.kubernetes.azure.com cert-manager.io/cluster-issuer: letsencrypt-prodspec: tls: - secretName: sample-app-ingress-cert-prod hosts: - app.example.net rules: - host: app.example.net http: paths: - path: / pathType: Prefix backend: service: name: sample-test port: number: 80Running this test, you can confirm the certificate was issued successfully:


Operational considerations
Section titled āOperational considerationsā- Validate with the staging issuer first. Letās Encrypt issues at most 50 certificates per registered domain every 7 days, and 5 certificates per exact set of domains every 7 days. Repeatedly retrying against the prod issuer while fixing configuration can hit these limits and block issuance for days. Switch the annotation to
letsencrypt-prodonly after the Certificate becomesReadywith staging. - HTTP-01 requires inbound access on port 80 from the internet. Letās Encrypt connects directly to
http://<domain>/.well-known/acme-challenge/..., so domains behind a private Ingress or firewall fail. For those, and for wildcard certificates (*.example.com), use DNS-01. With Azure DNS, give cert-manager a workload identity so it can create the TXT records. - ClusterIssuer is a cluster-scoped resource. The
metadata.namespacein the example above is ignored. The ACME account key Secret (privateKeySecretRef) is created in the namespace where cert-manager is installed (cert-managerby default). - When issuance stalls, follow the resources in order. cert-manager creates
Certificate ā CertificateRequest ā Order ā Challenge. The events fromkubectl describe challenge -n <namespace>record the actual cause, such as an HTTP response code or a DNS lookup failure. - Monitor expiry. Even if automatic renewal fails, the existing certificate looks fine until it expires. Alert on certificates with fewer than 14 days left using the
certmanager_certificate_expiration_timestamp_secondsmetric that cert-manager exposes.
A note on Letās Encrypt
Section titled āA note on Letās EncryptāLetās Encrypt is a nonprofit that issues free TLS certificates. Among the types of TLS certificates, it issues fully automatable DV (Domain Validated) certificates for free, using the ACME protocol (RFC 8555). Itās not limited to a root domain or a single subdomain, it also issues free wildcard certificates (*.example.com) that cover every subdomain under one certificate (wildcards are issued only through DNS-01). Issued certificates are valid for 90 days, and cert-manager renews by default at 2/3 of the lifetime (about 30 days before expiry for a 90-day certificate). Renewals that use ACME Renewal Info (ARI) are exempt from the issuance limits, but other renewals may still be subject to some of them, so find the cause of a failed renewal before retrying repeatedly.
cert-manager is a Kubernetes utility that automates certificate management (issuance, renewal), and supports both DNS-based and HTTP-request-based issuance for ACME. HTTP-request-based issuance requires the domain being certified to be reachable over HTTP.
Wrapping up
Section titled āWrapping upāAutomating security controls across the whole supply chain (from Secret management, to image vulnerability scanning, to SBOM/signing, CSPM, and automated TLS certificates) as code turns the deployment pipeline itself into the basis for trust. The next article covers the Kubernetes operations practice that these security controls run on top of: Utility configuration, performance testing, and backup/recovery.
Previous / next post
Section titled āPrevious / next postāPrevious post: Operating Cloud Security Posture with CSPM