Configure SSL in Kubernetes
In Kubernetes, the usual way to serve HTTPS is to terminate TLS at an Ingress controller and let cert-manager obtain and renew certificates from an ACME CA such as Let's Encrypt. Once it is set up, adding HTTPS to a new service is a few lines of YAML.
SSL in Kubernetes: how the pieces fit
| Component | Role |
|---|---|
| Ingress controller (for example ingress-nginx) | Receives traffic and terminates TLS |
| cert-manager | Requests, stores and renews certificates |
| ClusterIssuer or Issuer | Defines which CA to use and how to prove domain control |
| Secret | Holds the certificate and private key |
| Ingress resource | Maps hostnames to services and references the Secret |
Prerequisites
- A working cluster and kubectl access.
- An Ingress controller with a public load balancer IP.
- A DNS record for your hostname pointing at that IP. Check it with the DNS lookup tool.
- Ports 80 and 443 open to the internet for HTTP-01 validation.
Step 1: Install cert-manager
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager \
--namespace cert-manager --create-namespace \
--set crds.enabled=true
Older chart versions use installCRDs=true instead of crds.enabled. Check the chart documentation for the version you install. Then confirm the pods are running with kubectl get pods -n cert-manager.
SSL in Kubernetes, step 2: the ClusterIssuer
Start with the Let's Encrypt staging server to avoid rate limits while testing.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging
spec:
acme:
server: https://acme-staging-v02.api.letsencrypt.org/directory
email: you@example.com
privateKeySecretRef:
name: letsencrypt-staging-key
solvers:
- http01:
ingress:
ingressClassName: nginx
When staging works, create a second issuer named letsencrypt-prod with the server URL https://acme-v02.api.letsencrypt.org/directory.
Step 3: Request a certificate through the Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
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
port:
number: 80
cert-manager sees the annotation, creates a Certificate resource, completes the challenge, and writes the result into the named Secret. The Ingress controller then serves it.
Step 4: Verify
kubectl get certificate
kubectl describe certificate app-example-com-tls
kubectl get challenges,orders -A
Ready should show True. Then check from outside with the Live SSL Checker. If you started with staging, the certificate will show an untrusted staging issuer; that is expected. Switch the annotation to production once it works.
Troubleshooting
- Challenge stays pending: DNS does not point at the Ingress, port 80 is blocked, or another Ingress rule or redirect intercepts the challenge path.
- Wildcard needed: use a DNS-01 solver with your DNS provider's API credentials.
- Fake certificate served: the Ingress controller's default certificate shows when the Secret is missing or the host does not match.
- Rate limits: use staging for tests and avoid deleting and recreating production certificates repeatedly.
Related reading: free SSL on nginx, SSL for MySQL and securing an API gateway with TLS.
Frequently Asked Questions
Does cert-manager renew automatically?
Yes. It renews before expiry, and the Ingress controller reloads the updated Secret.
Can I use my own certificate instead?
Yes. Create a TLS Secret from your files with kubectl create secret tls and reference it in the Ingress. You can issue one for free with TryFreeSSL.
Where should TLS terminate?
At the Ingress for most setups. A service mesh can add mutual TLS between pods.
How do I force HTTPS?
ingress-nginx redirects HTTP to HTTPS by default when TLS is configured for the host.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.