Skip to content

cert-manager (Kubernetes)

cert-manager issues certificates for Kubernetes workloads and Ingresses. Create a ClusterIssuer for BastionXP CA's ACME server:

clusterissuer.yaml
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: bastionxp-ca
spec:
  acme:
    server: https://ca.example.com:8443/acme/directory
    # The CA's root, base64-encoded PEM: base64 -w0 root.crt
    caBundle: LS0tLS1CRUdJTi...
    privateKeySecretRef:
      name: bastionxp-ca-acme-account
    solvers:
      - http01:
          ingress:
            ingressClassName: nginx

Request a certificate:

certificate.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: web
  namespace: default
spec:
  secretName: web-tls
  dnsNames: [web.example.com]
  issuerRef:
    kind: ClusterIssuer
    name: bastionxp-ca

or annotate an Ingress with cert-manager.io/cluster-issuer: bastionxp-ca.

dns-01 with your own DNS server

For wildcards, or when the CA cannot reach the cluster's Ingress, prove the names with dns01. With a DNS server that takes signed updates (RFC 2136: BIND, Windows DNS, PowerDNS), cert-manager writes the TXT records itself:

clusterissuer.yaml (solvers)
    solvers:
      - dns01:
          rfc2136:
            nameserver: 10.0.0.53:53
            tsigKeyName: cert-manager
            tsigAlgorithm: HMACSHA256
            tsigSecretSecretRef:      # a Secret in the cert-manager namespace
              name: rfc2136-tsig
              key: secret

If the zone is private (for example corp.internal), two more settings are needed:

  • cert-manager checks that its TXT record is visible before it asks the CA, by default through public DNS, which does not know a private zone. Point it at your DNS server, with the controller's flags --dns01-recursive-nameservers-only=true and --dns01-recursive-nameservers=10.0.0.53:53 (Helm values dns01RecursiveNameserversOnly and dns01RecursiveNameservers).
  • BastionXP CA must ask the same DNS server for the TXT records: set acme.dns_resolver: 10.0.0.53:53 (see ACME server setup).

Notes

  • The CA must reach the Ingress on port 80 for http01.
  • The names must be in acme.allowed_domains. For any other name, the Order fails with rejectedIdentifier and the CA's reason.
  • Workloads that verify each other with these certificates need the BastionXP CA root in their trust bundle (for example with trust-manager).

Tested

BastionXP CA's integration tests run cert-manager v1.21.3 in a Kubernetes v1.37 cluster once a week, with BastionXP CA in the same cluster and dns-01 over RFC 2136 to a BIND server, set up as above: a certificate, a wildcard, a new certificate when the names change, and the refusal of a name outside acme.allowed_domains.