Home KubernetesKubernetes Ingress TLS with cert-manager and Let’s Encrypt

Kubernetes Ingress TLS with cert-manager and Let’s Encrypt

by Knowledge Base Linux
Clean technical illustration of kubernetes ingress tls with cert-manager issuing a padlock-secured connection to a cluster, no text in image

Exposing a web application through Kubernetes is easy, but securing that traffic with HTTPS is where many clusters fall short. Setting up kubernetes ingress tls correctly means every request to your application is encrypted, browsers show the padlock instead of a warning, and you never have to renew certificates by hand. With cert-manager and Let’s Encrypt, the whole process becomes automatic: cert-manager requests, installs, and renews free TLS certificates for your Ingress resources without manual intervention.

Clean technical illustration of kubernetes ingress tls certificate issuance flow with a padlock and server nodes, no text in image

In this guide you will install cert-manager, configure a Let’s Encrypt ClusterIssuer, and attach a valid certificate to an NGINX Ingress. This kubernetes ingress tls setup follows the standard production pattern, so every step here transfers directly to a real cluster. By the end, your application will serve HTTPS with a publicly trusted certificate, and renewals will happen on their own before expiry.

How Kubernetes Ingress TLS Works

An Ingress is a Kubernetes API object that manages external access to services inside the cluster, typically HTTP and HTTPS traffic. The Ingress controller, most commonly NGINX Ingress, reads Ingress resources and configures a reverse proxy accordingly. For TLS, the Ingress references a Kubernetes Secret that holds the certificate and private key, and the controller terminates TLS using that secret.

cert-manager automates the certificate lifecycle. It watches Ingress resources (and Certificate objects) for a specific annotation, talks to an ACME certificate authority such as Let’s Encrypt, proves you control the domain through an HTTP-01 or DNS-01 challenge, and stores the resulting certificate in the named Secret. Before expiry, it renews the certificate and updates the Secret, so the Ingress picks up the new certificate with no downtime and no human action.

Component Role
Ingress Declares hostnames, paths, and the TLS Secret name
Ingress controller Terminates TLS and routes traffic to Services
cert-manager Requests, installs, and renews certificates automatically
ClusterIssuer Cluster-wide ACME configuration pointing at Let’s Encrypt
Let’s Encrypt Free, publicly trusted certificate authority

Prerequisites

Before you start, make sure you have the following in place:

  • A running Kubernetes cluster (version 1.28 or newer recommended) with an NGINX Ingress controller installed.
  • kubectl configured with cluster-admin access to the cluster.
  • A public domain name whose DNS A record points to the external IP address of your Ingress controller’s load balancer.
  • Port 80 and port 443 reachable from the internet, since the HTTP-01 challenge requires Let’s Encrypt to reach your domain on port 80.
  • Helm is optional for this guide; we install cert-manager with plain kubectl manifests.

If you do not have a cluster yet, see our guide on installing a Kubernetes cluster with kubeadm on Ubuntu first, then return here. A working kubernetes ingress tls setup also assumes your Ingress controller already serves plain HTTP traffic for the domain, since the ACME challenge runs over HTTP before HTTPS is enabled.

Install cert-manager

cert-manager runs as a set of Deployments in its own namespace. Install the latest stable release with the official manifest. Replace the version number with the newest release listed in the cert-manager documentation if a newer one is available.

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml

The manifest creates the cert-manager namespace, the CustomResourceDefinitions for Issuer, ClusterIssuer, and Certificate, and the controller, webhook, and CA injector Deployments. Wait for the pods to become ready:

kubectl get pods -n cert-manager

You should see three pods in Running state: cert-manager, cert-manager-cainjector, and cert-manager-webhook. If any pod stays in CrashLoopBackOff, check its logs with kubectl logs -n cert-manager deploy/cert-manager before continuing. Do not create issuers until all three pods are ready, because the webhook validates Certificate resources, and a half-installed cert-manager is the most common reason a kubernetes ingress tls deployment stalls at the first step.

Create a Let’s Encrypt ClusterIssuer for Kubernetes Ingress TLS

A ClusterIssuer is a cluster-wide issuer that any namespace can reference. We create two: one for the Let’s Encrypt staging environment to test against, and one for production. Staging certificates are not trusted by browsers, but staging has much higher rate limits, so always validate your setup there first and switch to production only when issuance works.

Create a file named cluster-issuer.yaml with the staging issuer:

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-staging
spec:
  acme:
    email: [email protected]
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-staging
    solvers:
      - http01:
          ingress:
            ingressClassName: nginx

Apply it, then create the production issuer by copying the file, changing the name to letsencrypt-prod, and changing the server URL to https://acme-v02.api.letsencrypt.org/directory:

kubectl apply -f cluster-issuer.yaml
kubectl get clusterissuer

Both issuers should show Ready: True in the output. If an issuer is not ready, describe it with kubectl describe clusterissuer letsencrypt-staging and check the ACME account registration error. The email address is used by Let’s Encrypt only for expiry notices and account recovery; use a real address you monitor.

Expose Your App with Kubernetes Ingress TLS

Now create an Ingress that routes traffic to your application and asks cert-manager to issue a certificate. The key parts are the tls section, which names the hosts and the Secret that will hold the certificate, and the cert-manager.io/cluster-issuer annotation, which tells cert-manager which issuer to use. The nginx.ingress.kubernetes.io/ssl-redirect annotation forces HTTP traffic to redirect to HTTPS.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-app-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-staging"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - app.example.com
      secretName: app-example-com-tls
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web-app
                port:
                  number: 80

Apply the Ingress and watch cert-manager do its work:

kubectl apply -f web-app-ingress.yaml
kubectl get certificate
kubectl describe certificate app-example-com-tls

Within a minute or two, the Certificate should report Ready: True. cert-manager creates a temporary challenge Ingress rule, Let’s Encrypt fetches a token over HTTP from your domain, and once the challenge succeeds, the certificate is stored in the app-example-com-tls Secret. When staging works, change the annotation to letsencrypt-prod, delete the old Secret so a fresh production certificate is issued, and re-apply.

Verify Your Kubernetes Ingress TLS Certificate

First, confirm the certificate object and the Secret exist:

kubectl get certificate app-example-com-tls
kubectl get secret app-example-com-tls

Then test the endpoint from outside the cluster. A successful response with no certificate warning confirms the chain is valid:

curl -I https://app.example.com

You should see HTTP/2 200 (or HTTP/1.1 200 OK) and no TLS errors. To inspect the certificate details, including issuer and expiry date, use:

echo | openssl s_client -servername app.example.com -connect app.example.com:443 2>/dev/null | openssl x509 -noout -issuer -dates

For a production certificate the issuer should be Let’s Encrypt. cert-manager renews certificates automatically starting 30 days before expiry by default, so after this point you should not need to touch the certificate again. That self-renewal is the main reason a kubernetes ingress tls setup built on cert-manager stays healthy with no ongoing maintenance.

Troubleshooting Kubernetes Ingress TLS

Most failures happen during the ACME challenge. The following table covers the common cases:

Symptom Likely cause and fix
Certificate stuck at Issuing, challenge pending Let’s Encrypt cannot reach your domain on port 80. Check the DNS A record, firewall rules, and that the Ingress controller has a public IP.
Challenge fails with 404 Another Ingress or controller is intercepting the challenge path. Make sure only one Ingress controller handles the domain, and check the challenge solver pod logs.
rateLimited error from Let’s Encrypt You hit the production rate limit of 50 certificates per registered domain per week. Switch to staging while testing, and use one wildcard or shared certificate where possible.
Browser shows an untrusted certificate You are still using the staging issuer. Change the annotation to letsencrypt-prod, delete the old Secret, and wait for re-issuance.
Certificate not renewing Check kubectl get certificate events and the cert-manager controller logs. Renewal starts 30 days before expiry; a missing or deleted Secret triggers re-issuance automatically.

For deeper diagnosis, inspect the challenge objects directly:

kubectl get challenges -A
kubectl describe challenge -n default <challenge-name>

If your domain is behind a firewall that blocks port 80, or you need wildcard certificates, switch from HTTP-01 to DNS-01 challenges. DNS-01 requires cert-manager to create TXT records through your DNS provider’s API, which is documented in the official cert-manager documentation. Wildcard certificates are only possible with DNS-01, never with HTTP-01.

Conclusion

With cert-manager and Let’s Encrypt, kubernetes ingress tls stops being a recurring chore and becomes a one-time setup. You installed cert-manager, registered staging and production ClusterIssuers, attached a certificate to an NGINX Ingress, and verified the result end to end. From here, every new application only needs the same two ingredients: a tls block and the cluster-issuer annotation.

For more on routing traffic inside your cluster, read our Kubernetes Ingress with NGINX routing guide. If you run multiple domains or need wildcard coverage, your next step is DNS-01 challenges with your DNS provider, which extend this same kubernetes ingress tls pattern to wildcard certificates.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.