A cert-manager external issuer for ZeroSSL that enables automated SSL/TLS certificate management using the ZeroSSL API.
This project implements a cert-manager external issuer that integrates with ZeroSSL to automate the process of obtaining, renewing, and managing SSL/TLS certificates in Kubernetes clusters.
- Kubernetes cluster (v1.19+)
- cert-manager (v1.6.0+)
- ZeroSSL API key
-
Install cert-manager (if not already installed):
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml
-
Install the ZeroSSL issuer using Helm:
# Clone the repository (if you don't have the chart locally) git clone https://github.com/topfreegames/zerossl-issuer.git cd zerossl-issuer # Install the chart helm install zerossl-issuer ./helm/zerossl-issuer
See the Helm chart README for detailed configuration options.
-
Install cert-manager (if not already installed):
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml
-
Install the ZeroSSL issuer:
kubectl apply -f https://raw.githubusercontent.com/topfreegames/zerossl-issuer/main/config/crd/bases/zerossl.cert-manager.io_issuers.yaml kubectl apply -f https://raw.githubusercontent.com/topfreegames/zerossl-issuer/main/config/crd/bases/zerossl.cert-manager.io_challenges.yaml kubectl apply -f https://raw.githubusercontent.com/topfreegames/zerossl-issuer/main/config/manager/manager.yaml
-
Create a Secret containing your ZeroSSL API key:
apiVersion: v1 kind: Secret metadata: name: zerossl-api-key namespace: cert-manager type: Opaque stringData: api-key: your-api-key-here
-
Create a ZeroSSL Issuer:
apiVersion: zerossl.cert-manager.io/v1alpha1 kind: Issuer metadata: name: zerossl-issuer namespace: default spec: apiKeySecretRef: name: zerossl-api-key key: api-key validityDays: 90 # Optional: defaults to 90 strictDomains: true # Optional: defaults to true
apiVersion: zerossl.cert-manager.io/v1alpha1 kind: Issuer metadata: name: zerossl-dns-issuer namespace: default spec: apiKeySecretRef: name: zerossl-api-key key: api-key validityDays: 90 strictDomains: true solvers: - dns01: route53: accessKeyID: AKIAEXAMPLE123456789 hostedZoneID: Z2E9THH2A4HU6P region: us-east-1 secretAccessKeySecretRef: key: secret name: route53-credentials selector: dnsZones: - example.com
-
Create AWS credentials secret for Route53 (if using DNS validation):
apiVersion: v1 kind: Secret metadata: name: route53-credentials namespace: default type: Opaque stringData: secret: your-aws-secret-key-here
Once the issuer is configured, you can create certificates using cert-manager's Certificate resource:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: example-com
namespace: default
spec:
secretName: example-com-tls
issuerRef:
name: zerossl-issuer
kind: Issuer
group: zerossl.cert-manager.io
dnsNames:
- example.com
- www.example.com
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: wildcard-example-com
namespace: default
spec:
secretName: wildcard-example-com-tls
issuerRef:
name: zerossl-dns-issuer
kind: Issuer
group: zerossl.cert-manager.io
dnsNames:
- "*.example.com" # ZeroSSL wildcard certificates must be single domain only
The ZeroSSL issuer integrates seamlessly with NGINX Ingress Controller using cert-manager annotations. Here's a basic example:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
namespace: default
annotations:
# Enable cert-manager to automatically create certificates
cert-manager.io/issuer: "zerossl-issuer"
cert-manager.io/issuer-kind: "Issuer"
cert-manager.io/issuer-group: "zerossl.cert-manager.io"
# NGINX Ingress Controller annotations
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
tls:
- hosts:
- app.example.com
secretName: app-tls-certificate
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app-service
port:
number: 80
cert-manager.io/issuer
: Name of your ZeroSSL issuercert-manager.io/issuer-kind
: Set to "Issuer" or "ClusterIssuer"cert-manager.io/issuer-group
: Set to "zerossl.cert-manager.io"
cert-manager.io/duration
: Certificate validity period (e.g., "2160h" for 90 days)cert-manager.io/renew-before
: When to start renewal process (e.g., "720h" for 30 days before expiry)
Important: ZeroSSL wildcard certificates must be single domain only (e.g., *.example.com
). You cannot combine wildcards with other domains in the same certificate.
For more comprehensive examples including wildcard certificates and advanced configurations, see config/samples/nginx_ingress_example.yaml.
- Go 1.21+
- Kubebuilder
- Docker
-
Clone the repository:
git clone https://github.com/topfreegames/zerossl-issuer.git cd zerossl-issuer
-
Install dependencies:
go mod download
-
Build the controller:
make
Run the test suite:
make test
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.