Overview
Manages the full lifecycle of SSL/TLS certificates: provisioning via Let's Encrypt (HTTP-01 and DNS-01 challenges), wildcard certificates, automated renewal, Kubernetes cert-manager integration, monitoring of expiry, and troubleshooting failed renewals. Includes cron jobs, hooks, and multi-domain (SAN) setups.
When to Use This Skill
- Adding HTTPS to a domain or subdomain for the first time.
- Setting up wildcard certs (
*.example.com). - Automating renewal for many certificates.
- Deploying to Kubernetes.
Prerequisites
- Domain control (DNS or web server for challenge).
- For DNS challenge: API access to DNS provider (Cloudflare, Route53, etc.).
- Nginx, Caddy, or ingress controller that can use the certificates.
Steps
Choose challenge type:
- HTTP-01: Easy for single domains when you control the web server.
- DNS-01: Required for wildcards and when you don't want to expose port 80.
Provision with certbot (standalone or webroot):
certbot certonly --nginx -d example.com -d www.example.com # or DNS certbot certonly --dns-cloudflare -d '*.example.com' -d example.comAutomated renewal:
- certbot renew runs twice a day via systemd timer or cron.
- Use
--deploy-hookto reload Nginx or restart services after successful renew.
Kubernetes (cert-manager):
- Install cert-manager.
- Create Issuer or ClusterIssuer (Let's Encrypt production/staging).
- Create Certificate resources or use annotations on Ingress.
- Wildcard via DNS01 solver with Cloudflare or Route53 secret.
Monitoring & alerting:
- Check certificate expiry (e.g., with
certbot certificatesor Prometheus blackbox / cert-exporter). - Alert when < 30 days remaining.
- Check certificate expiry (e.g., with
Multi-domain (SAN):
- List all domains in one certificate when they share the same server.
Output:
- Exact certbot commands for the domains.
- Systemd timer or cron for renewal + deploy hook.
- cert-manager YAML for Kubernetes.
- Expiry monitoring script or Prometheus rule.
- Troubleshooting steps for common renewal failures (rate limits, DNS propagation, webroot path wrong).
Examples
Full certbot commands for single + wildcard, a production renewal cron with deploy hook that reloads Nginx, and a complete cert-manager setup for a Kubernetes Ingress with wildcard are included.
Edge Cases & Error Handling
- Rate limits: Use staging for testing (
--staging), respect 50 certs/week per domain for production. - DNS propagation: For DNS-01, wait or use a provider with fast propagation.
- Certificate not picked up: Check file permissions and service reload.
- Revocation: Have a process to revoke and re-issue if key is compromised.
Verification
https://example.comshows a valid certificate (padlock, not self-signed).certbot certificatesshows the cert and next renewal date.- Renewal test:
certbot renew --dry-runsucceeds. - In Kubernetes:
kubectl get certificateshows Ready=True. - Expiry alert would fire if the cert were close to expiring.
- Success: All domains have valid, auto-renewing certificates with >30 days validity at all times.