SSL/TLS Certificates¶
KanjiIQ uses cert-manager with Let's Encrypt for automatic TLS certificate provisioning and renewal.
How It Works¶
sequenceDiagram
participant I as Ingress Resource
participant CM as cert-manager
participant LE as Let's Encrypt
participant T as Traefik
participant S as K8s Secret
I->>CM: New Ingress with cert-manager annotation
CM->>LE: Request certificate (ACME HTTP-01)
LE->>T: HTTP-01 challenge request
T->>LE: Challenge response
LE->>CM: Certificate issued
CM->>S: Store as TLS Secret
T->>S: Read certificate
Note over T: HTTPS now active
CM->>CM: Monitor expiry (auto-renew at 30 days)
ClusterIssuer¶
A cluster-wide issuer is configured for Let's Encrypt production:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: traefik
Requesting Certificates¶
Any Ingress resource can request a TLS certificate by adding a single annotation:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
tls:
- hosts:
- kanjiiq.com
- api.kanjiiq.com
secretName: kanjiiq-tls # cert-manager creates this
cert-manager watches for Ingress resources with its annotation and automatically:
- Creates a Certificate resource
- Performs the ACME HTTP-01 challenge via Traefik
- Stores the issued certificate in the specified Secret
- Renews 30 days before expiry
Current Certificates¶
| Secret Name | Domains | Ingress |
|---|---|---|
kanjiiq-tls |
kanjiiq.com, www.kanjiiq.com, api.kanjiiq.com, admin.kanjiiq.com |
ingress-kanjiiq.yaml |
kanjiiq-docs-tls |
docs.kanjiiq.app |
ingress-docs.yaml |
Troubleshooting¶
Check certificate status:
# List all certificates
kubectl get certificates -n jlpt-kanji
# Check certificate details
kubectl describe certificate kanjiiq-tls -n jlpt-kanji
# Check cert-manager logs
kubectl logs -n cert-manager deploy/cert-manager
# View certificate challenges in progress
kubectl get challenges -n jlpt-kanji
Common issues:
- Challenge fails: Ensure DNS A records point to the server and port 80 is accessible
- Rate limited: Let's Encrypt has a 50 certificates/week limit per domain
- Secret not created: Check cert-manager logs for ACME errors