This project automates the setup of Rancher using K3s, Cert-Manager, and Let's Encrypt with Cloudflare DNS.
config.env.example– Copy this toconfig.envand edit for your domain1-install-k3s.sh– Installs K3s (no Traefik) and sets up kubeconfig for user 'erin'2-install-cert-manager.sh– Installs cert-manager v1.17.13-install-rancher.sh– Installs Rancher via Helm using the hostname from configclusterissuer.yaml.template– Cert-Manager issuer using Cloudflare DNS challengerancher-cert.yaml.template– TLS cert for Rancher ingressbootstrap.sh– Optional script to render YAMLs and apply everything
-
Copy and edit your configuration:
cp config.env.example config.env nano config.env
-
Run scripts in order:
chmod +x *.sh ./1-install-k3s.sh ./2-install-cert-manager.sh ./bootstrap.sh ./3-install-rancher.sh
If you prefer not to use templates, just replace values like domain and email directly inside:
clusterissuer.yamlrancher-cert.yaml- Helm commands in
3-install-rancher.sh
Then skip the .env and envsubst steps entirely.
- Cloudflare API token with DNS edit permissions
- DNS A record pointing your domain (e.g. rancher.example.com) to the node IP