🔒
Security

Certbot (Let's Encrypt)

Free HTTPS/SSL certificates for your website

🐧 Linux🍎 Mac🪟 Windows
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

What is this?

Certbot gets free HTTPS certificates from Let's Encrypt so your website shows the padlock icon.

📁

Config files for Certbot (Let's Encrypt)

Where to create or edit the main configuration — paths below match the setup steps.

  • /etc/letsencrypt/

    Location: Certificate store on server

    Issued certs and renewal configs

📥

Step 01

Install Certbot

(01)Install

Linux
1sudo apt-get install -y certbot python3-certbot-nginx
2# Or standalone:
3sudo apt-get install -y certbot
⚙️

Step 02

Get SSL Certificate

(01)Obtain and auto-configure nginx

Linux
1sudo certbot --nginx -d example.com -d www.example.com
2# Auto-renewal test:
3sudo certbot renew --dry-run

Step 03

Verify

(01)Check cert

Linux
1sudo certbot certificates
2curl -I https://example.com

Step 04

Manage

(01)Renew

Linux
1sudo certbot renew
2sudo systemctl status certbot.timer

📋Config templates

1 YAML template for Certbot (Let's Encrypt). Copy and deploy after setup.

1 ready-to-copy template. Expand one, copy the YAML, then run the deploy commands.

Ingress.yml

yaml
1apiVersion: networking.k8s.io/v1
2kind: Ingress
3metadata:
4 name: minimal-ingress
5 annotations:
6 nginx.ingress.kubernetes.io/rewrite-target: /
7spec:
8 rules:
9 - http:
10 paths:
11 - path: /testpath
12 pathType: Prefix
13 backend:
14 service:
15 name: test
16 port:
17 number: 80
📄

Step 01

Deploy Ingress

(01)Install NGINX Ingress Controller

Linux
1kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/cloud/deploy.yaml
2kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=120s

(02)Apply Ingress resource

Linux
1kubectl apply -f Ingress.yml
2kubectl get ingress
3kubectl describe ingress minimal-ingress