Table of Contents

Cert-Manager

Cert-Manager is a Kubernetes-native tool that automates the management and issuance of TLS certificates within a Kubernetes cluster. It leverages Kubernetes Custom Resource Definitions (CRDs) to define certificate requests and manage the lifecycle of certificates, including issuance, renewal, and revocation.

Key Features

Benefits

Getting Started

Code Examples

1. **Certificate Definition:**

```yaml apiVersion: cert-manager.io/v1 kind: Certificate metadata:

 name: my-certificate
spec:
 secretName: my-certificate-tls  # Name of the secret to store the certificate
 issuerRef:
   name: letsencrypt-prod  # Name of the Issuer resource
   kind: ClusterIssuer
 commonName: www.example.com
 dnsNames:
 - www.example.com
```

This configuration defines a Certificate resource that requests a certificate for “[www.example.com](https://www.example.com)” from the “letsencrypt-prod” ClusterIssuer. The issued certificate will be stored in a Secret named “my-certificate-tls.”

2. **Issuer Definition (for Let's Encrypt):**

```yaml apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata:

 name: letsencrypt-prod
spec:
 acme:
   server: https://acme-v02.api.letsencrypt.org/directory
   email: admin@example.com
   privateKeySecretRef:
     name: letsencrypt-prod
   solvers:
   - http01:
       ingress:
         class: nginx
```

This configuration defines a ClusterIssuer that uses Let's Encrypt's ACME protocol to issue certificates. It specifies the ACME server URL, the email address for notifications, and the solver to use for domain validation (in this case, HTTP-01 challenge using the “nginx” ingress class).

Additional Resources

Additional Resources