This page shows how to use cert-manager to create a private certificate authority (CA) from a self-signed issuer, then use that CA to issue TLS certificates for Kubernetes Ingress resources. The manifests above set up the chain, but they contain naming and annotation mistakes that stop the Ingress certificate from being issued correctly. A corrected, tested version follows, along with verification steps and troubleshooting.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: letsencrypt-ca
namespace: sandbox
spec:
ca:
secretName: letsencrypt-ca
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: letsencrypt-ca
namespace: sandbox
spec:
isCA: true
commonName: osm-system
secretName: letsencrypt-ca
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
group: cert-manager.ioCode language: JavaScript (javascript)
kubectl get secret --namespace=sandbox
NAME TYPE DATA AGE
letsencrypt-ca kubernetes.io/tls 3 Xs
kubectl get certificates --namespace=sandboxCode language: JavaScript (javascript)
Secure Ingress Resources With Cert Manager
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
annotations:
# Set up your ingress.class below (in this example, we are using nginx ingress controller)
kubernetes.io/ingress.class: "nginx"
cert-manager.io/issuer: "letsencrypt-prod"
spec:
tls:
# Replace the DOMAIN placeholder with the correct domain name
- hosts:
- DOMAIN
secretName: letsencrypt-ca
rules:
# Replace the DOMAIN placeholder with the correct domain name
- host: DOMAIN
http:
paths:
- path: /
pathType: Exact
backend:
service:
name: ingress-test
port:
number: 80
How the self-signed CA chain works
A selfSigned issuer signs each certificate with that certificate's own private key. If you used it directly for every Ingress, each certificate would be its own root, and clients would have to trust each one separately. The usual pattern is to use the self-signed issuer once, to create a CA certificate. A ca issuer then signs all application certificates with that CA, so clients only need to trust one ca.crt.
| Resource | Role in the chain | Output |
|---|---|---|
ClusterIssuer (selfSigned) | Bootstraps the root by self-signing the CA certificate | Nothing on its own |
Certificate (isCA: true) | Requests the CA certificate from the self-signed issuer | Secret with tls.crt, tls.key, ca.crt |
Issuer (ca) | Signs leaf certificates using the CA Secret | Leaf certificates for apps |
| Ingress + cert-manager annotation | Asks cert-manager to create a Certificate for the hosts in spec.tls | Secret mounted by the Ingress controller |
Note: Nothing in this setup involves Let's Encrypt. The names letsencrypt-prod and letsencrypt-ca in the example above are misleading. The corrected version uses names that describe what each resource does.
Prerequisites and installing cert-manager
- A Kubernetes cluster and
kubectlwith cluster-admin rights. - An Ingress controller. These examples use ingress-nginx with the IngressClass
nginx. - Helm 3 to install cert-manager.
opensslandcurlon your workstation for verification.
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
# Wait for the controller, webhook and cainjector to be ready
kubectl -n cert-manager rollout status deploy/cert-manager-webhook
kubectl get pods -n cert-manager
# Namespace and a sample backend for the Ingress
kubectl create namespace sandbox
kubectl -n sandbox create deployment ingress-test --image=nginx
kubectl -n sandbox expose deployment ingress-test --port=80Code language: JavaScript (javascript)
Note: Older chart versions use --set installCRDs=true instead of crds.enabled. Check the values for the chart version you install. If you apply Issuers before the webhook is ready, you get failed calling webhook errors. Wait for the rollout, then apply again.
Corrected manifests
Save the following as ca-bootstrap.yaml. It is the same three-resource chain as the example above, with clearer names and an explicit key algorithm and lifetime for the CA.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned-bootstrap
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: sandbox-ca
namespace: sandbox
spec:
isCA: true
commonName: sandbox-ca
secretName: sandbox-ca-secret
duration: 8760h # 1 year
renewBefore: 720h # 30 days
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: selfsigned-bootstrap
kind: ClusterIssuer
group: cert-manager.io
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: sandbox-ca-issuer
namespace: sandbox
spec:
ca:
secretName: sandbox-ca-secret
Save the following as ingress.yaml. Replace app.sandbox.example.com with your hostname.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
namespace: sandbox
annotations:
cert-manager.io/issuer: "sandbox-ca-issuer"
spec:
ingressClassName: nginx
tls:
- hosts:
- app.sandbox.example.com
secretName: ingress-test-tls # must NOT be the CA secret
rules:
- host: app.sandbox.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ingress-test
port:
number: 80
- Annotation points to the CA issuer. The original used
cert-manager.io/issuer: "letsencrypt-prod", but that name belongs to a ClusterIssuer. Theissuerannotation only looks up namespaced Issuers, so the lookup fails. Even withcert-manager.io/cluster-issuer, every certificate would be self-signed. The annotation should reference thecaIssuer. - Separate leaf secret. The original set the Ingress
secretNametoletsencrypt-ca, which is the CA's own Secret. cert-manager would create a second Certificate that writes to the same Secret, and the two would overwrite each other. The CA key could also end up being served as the site certificate. - Namespace set. A namespaced
Issuercan only issue certificates in its own namespace, so the Ingress must live insandbox. ingressClassNameinstead of the deprecatedkubernetes.io/ingress.classannotation.pathType: Prefix. WithExact,/matches only the root path, and requests such as/index.htmlreturn 404.
Apply and verify
- Apply the CA chain:
kubectl apply -f ca-bootstrap.yaml. - Confirm the CA certificate and issuer are ready:
kubectl get certificate,issuer -n sandbox. - Apply the Ingress:
kubectl apply -f ingress.yaml. cert-manager's ingress-shim creates a Certificate named aftersecretName. - Check that both certificates report
READY True.
kubectl get certificate -n sandbox
NAME READY SECRET AGE
ingress-test-tls True ingress-test-tls 15s
sandbox-ca True sandbox-ca-secret 1m
kubectl get issuer -n sandbox
NAME READY AGE
sandbox-ca-issuer True 1m
# Inspect the leaf certificate: issuer should be CN=sandbox-ca
kubectl get secret ingress-test-tls -n sandbox \
-o jsonpath='{.data.tls\.crt}' | base64 -d \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltNameCode language: PHP (php)
Each Secret has three data keys (tls.crt, tls.key, ca.crt), which is why the example above shows DATA 3. If a certificate stays False, run kubectl describe certificate <name> -n sandbox and then kubectl get certificaterequest -n sandbox. The Events section usually names the exact problem.
Test HTTPS and trust the CA
Browsers and curl reject the certificate until the client trusts your private CA. Export ca.crt and pass it to curl. The --resolve flag lets you test without a DNS record.
kubectl get secret sandbox-ca-secret -n sandbox \
-o jsonpath='{.data.ca\.crt}' | base64 -d > sandbox-ca.crt
INGRESS_IP=$(kubectl get ingress ingress-test -n sandbox \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}')
curl -v --cacert sandbox-ca.crt \
--resolve app.sandbox.example.com:443:$INGRESS_IP \
https://app.sandbox.example.com/Code language: PHP (php)
A successful handshake shows SSL certificate verify ok and returns the nginx welcome page. On some cloud providers the load balancer exposes a hostname rather than an IP; in that case read .hostname instead of .ip. To trust the CA across a machine or a set of workloads, add sandbox-ca.crt to the OS trust store or mount it into the pods that call the service.
Common errors and fixes
| Symptom | Cause | Fix |
|---|---|---|
Event: issuer.cert-manager.io "..." not found | cert-manager.io/issuer annotation references a ClusterIssuer, or the Issuer is in another namespace | Use cert-manager.io/cluster-issuer for ClusterIssuers, or create the Issuer in the Ingress namespace |
Issuer READY False, secret ... not found | The CA Certificate has not been issued yet, or secretName does not match | Wait for the CA Certificate to be ready and check that both secret names match |
| Certificate flips between revisions or secret keeps changing | Two Certificates write to the same Secret (the original Ingress did this) | Give each Certificate its own secretName |
| Ingress serves the controller's default 'Fake Certificate' | Secret missing, wrong namespace, or host not listed in spec.tls.hosts | Check that the Secret exists in the Ingress namespace and that the hosts match the rules |
curl: (60) SSL certificate problem | Client does not trust the private CA | Pass --cacert or install ca.crt in the trust store |
failed calling webhook on apply | cert-manager webhook is not ready yet | Wait for the webhook deployment rollout, then reapply |
Best practices and security notes
- Use a private CA like this for development, internal services and test clusters. For public sites, use an ACME issuer such as Let's Encrypt so browsers trust the certificate automatically.
- The CA Secret holds the private key that can sign certificates for any hostname. Restrict who can read Secrets in its namespace with RBAC.
- To share one CA across namespaces, use a
caClusterIssuer. Its Secret must live in the cluster resource namespace, which iscert-managerby default. - Plan for CA renewal. When cert-manager renews the CA certificate, clients that pinned the old
ca.crtmay need the new one, especially if the private key rotates. Give the CA a longerdurationthan leaf certificates and automate distribution ofca.crt. - Keep the Certificate resources in Git. Never commit the generated Secrets.
Frequently asked questions
Is a cert-manager selfSigned issuer the same as Let's Encrypt?
No. A selfSigned issuer generates certificates locally without any external authority, so browsers do not trust them by default. Let's Encrypt requires an ACME issuer and a publicly reachable domain or DNS challenge.
What is the difference between cert-manager.io/issuer and cert-manager.io/cluster-issuer annotations?
cert-manager.io/issuer references a namespaced Issuer in the same namespace as the Ingress. cert-manager.io/cluster-issuer references a cluster-wide ClusterIssuer. If you use the wrong annotation, cert-manager reports that the issuer was not found.
Can I use the selfSigned issuer directly on an Ingress?
Yes, but each certificate is then its own root, and clients would have to trust every certificate individually. Bootstrapping a CA and signing leaf certificates with a ca issuer means clients only trust one ca.crt.
Why does my browser still show a certificate warning?
The certificate chains to your private CA, which the browser does not know about. Import the CA's ca.crt into the OS or browser trust store, or use a public ACME issuer for internet-facing hosts.
Does cert-manager renew self-signed and CA-issued certificates automatically?
Yes. cert-manager renews any Certificate before it expires, based on duration and renewBefore, including the CA certificate. Make sure clients receive the updated ca.crt when the CA renews.
Related tutorials
- More Security tutorials
- Cybersecurity and Information Security โ Complete Tutorial Collection
- The Complete Pomerium Tutorial: From Absolute Beginner to Advanced Zero Trust Access Engineering
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals