Installing certificates on Kubernetes
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Installing certificates on Kubernetes usually means one of two things: terminating HTTPS at an ingress, or mounting certificate material into workloads for internal TLS or mutual TLS. The mechanics are straightforward, but the operational choice matters more than the YAML. You need to decide who issues the certificate, where it is stored, and how renewal will happen before you start applying manifests.
Choose the Certificate Flow First
In practice, Kubernetes certificate setups usually fall into three patterns:
- a manually created TLS
Secret - automated issuance and renewal with
cert-manager - cloud or platform-managed certificates integrated with an ingress controller
Manual secrets are acceptable for development or tightly controlled internal systems. For anything public or long-lived, automated renewal is safer because certificate expiration is an operational failure, not just a configuration mistake.
Installing a Manual TLS Secret
If you already have a certificate and private key, Kubernetes expects them in a secret of type kubernetes.io/tls.
The equivalent manifest looks like this:
The key names matter. For this secret type, controllers expect tls.crt and tls.key. Putting different keys in the same secret may work for custom code, but it will not behave like a standard TLS secret.
Attaching the Certificate to an Ingress
The most common use of a certificate in Kubernetes is ingress termination. The ingress resource points to the TLS secret and lists the hostnames it covers.
After applying the ingress, verify both the Kubernetes side and the DNS side. If the hostname does not resolve to the ingress endpoint, the certificate can be correct and HTTPS will still appear broken from the client perspective.
Mounting Certificates Into Pods
Some applications need the certificate files inside the container, not only at ingress. In that case, mount the secret as a volume.
The mounted files are usually named after the secret keys, so the container sees /etc/tls/tls.crt and /etc/tls/tls.key.
Automating With cert-manager
For production clusters, cert-manager is the usual answer. It handles issuance and renewal by creating or refreshing the TLS secret on your behalf. A typical setup uses an issuer plus a certificate resource.
Once this is working, your ingress can keep referencing web-tls while cert-manager refreshes the contents as certificates rotate.
Verifying and Operating the Setup
A valid-looking manifest is not enough. Verify the deployed state.
For internal certificates mounted into pods, also verify the application process actually reloads or rereads the certificate after renewal. Some servers need a restart or a reload signal before they use the new files.
Common Pitfalls
The most frequent problem is putting the TLS secret in the wrong namespace. Ingress objects can only reference secrets in their own namespace.
Another issue is assuming a certificate is installed just because the secret exists. The ingress controller, DNS record, and certificate hostname must all align.
Teams also forget rotation. Manual certificate installation is easy on day one and painful on the day it expires. If the environment is long-lived, decide on renewal and alerting immediately.
Finally, avoid storing raw private keys in source control. Create secrets from secure files or a secret-management workflow, not from committed key material.
Summary
- Decide first whether certificates are manual, automated, or platform-managed.
- Use
kubernetes.io/tlssecrets withtls.crtandtls.keyfor standard TLS integration. - Reference the TLS secret from ingress for HTTPS termination.
- Mount the secret into pods when workloads need certificate files directly.
- Verify DNS, namespace, and renewal behavior instead of stopping at a successful
kubectl apply.

