MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Cert Manager: Generate TLS Certificates Using Self Signed Issuers

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.

ResourceRole in the chainOutput
ClusterIssuer (selfSigned)Bootstraps the root by self-signing the CA certificateNothing on its own
Certificate (isCA: true)Requests the CA certificate from the self-signed issuerSecret with tls.crt, tls.key, ca.crt
Issuer (ca)Signs leaf certificates using the CA SecretLeaf certificates for apps
Ingress + cert-manager annotationAsks cert-manager to create a Certificate for the hosts in spec.tlsSecret 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 kubectl with cluster-admin rights.
  • An Ingress controller. These examples use ingress-nginx with the IngressClass nginx.
  • Helm 3 to install cert-manager.
  • openssl and curl on 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. The issuer annotation only looks up namespaced Issuers, so the lookup fails. Even with cert-manager.io/cluster-issuer, every certificate would be self-signed. The annotation should reference the ca Issuer.
  • Separate leaf secret. The original set the Ingress secretName to letsencrypt-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 Issuer can only issue certificates in its own namespace, so the Ingress must live in sandbox.
  • ingressClassName instead of the deprecated kubernetes.io/ingress.class annotation.
  • pathType: Prefix. With Exact, / matches only the root path, and requests such as /index.html return 404.

Apply and verify

  1. Apply the CA chain: kubectl apply -f ca-bootstrap.yaml.
  2. Confirm the CA certificate and issuer are ready: kubectl get certificate,issuer -n sandbox.
  3. Apply the Ingress: kubectl apply -f ingress.yaml. cert-manager's ingress-shim creates a Certificate named after secretName.
  4. 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

SymptomCauseFix
Event: issuer.cert-manager.io "..." not foundcert-manager.io/issuer annotation references a ClusterIssuer, or the Issuer is in another namespaceUse cert-manager.io/cluster-issuer for ClusterIssuers, or create the Issuer in the Ingress namespace
Issuer READY False, secret ... not foundThe CA Certificate has not been issued yet, or secretName does not matchWait for the CA Certificate to be ready and check that both secret names match
Certificate flips between revisions or secret keeps changingTwo 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.hostsCheck that the Secret exists in the Ingress namespace and that the hosts match the rules
curl: (60) SSL certificate problemClient does not trust the private CAPass --cacert or install ca.crt in the trust store
failed calling webhook on applycert-manager webhook is not ready yetWait 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 ca ClusterIssuer. Its Secret must live in the cluster resource namespace, which is cert-manager by default.
  • Plan for CA renewal. When cert-manager renews the CA certificate, clients that pinned the old ca.crt may need the new one, especially if the private key rotates. Give the CA a longer duration than leaf certificates and automate distribution of ca.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

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
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.

Related Posts

How to generate Letsencrypt certificates with Verifying domain using API

acme.sh can get a Let's Encrypt certificate by proving you control a domain through your DNS provider's API. It creates a temporary TXT record, so you never…

Read More

Kubernetes Ingress Controller using Path-Based Routing: Complete Hands-On Lab with Calico VXLAN

Scope: Self-managed Kubernetes on two AWS EC2 Ubuntu nodes; install the community ingress-nginx v1.15.1 bare-metal/NodePort manifest, repair cross-node Calico networking, deploy two NGINX versions behind ClusterIP Services, configure path-based routing…

Read More

HTTP 404 for DevOps: Root-Cause, Routing, and Prevention Across Edge, Ingress, and App Layers

HTTP 404 errors are simple for users but often complex in distributed systems. This guide shows DevOps teams how to locate the failing layer, apply the right fix, and prevent repeat incidents.

Read More

Best Free, Open-Source & Self-Hosted Synthetic Monitoring, Uptime Monitoring and Health-Check Tools

Monitoring a service is no longer just about asking, โ€œDoes port 443 respond?โ€ Modern reliability monitoring may need to confirm that DNS resolves correctly, TLS certificates are…

Read More

Staff Kubernetes Engineer: Role Blueprint, Responsibilities, Skills, KPIs, and Career Path

The Staff Kubernetes Engineer is a senior individual contributor responsible for designing, evolving, and operating Kubernetes-based platforms that enable engineering teams to deliver software safely, reliably, and efficiently at scale. This role blends deep Kubernetes expertise with platform engineering practices, cloud infrastructure design, and strong operational leadership in incident response, resilience, and continuous improvement.

Read More

Senior Kubernetes Engineer: Role Blueprint, Responsibilities, Skills, KPIs, and Career Path

The Senior Kubernetes Engineer designs, builds, secures, and operates Kubernetes platforms that reliably run production workloads at scale. This role exists to provide a standardized, automated, and supportable container orchestration foundationโ€”so application teams can ship faster while meeting enterprise expectations for availability, security, cost, and compliance.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x