Welcome to the easiest, chillest, and most ๐ฅ way to spin up Rancher High Availability (HA) clusters on AWS using RKE2!
Just vibe, tweak a config, run a test, and you're Rancher-ready. ๐โก๏ธ๐
โ
No Cert Manager needed โ SSL is done via AWS ACM ๐
โ
Secure by default โ HTTPS from the jump ๐
โ
Fully automated โ Rancher installation happens automatically ๐ค
โ
All you gotta do:
- ๐ ๏ธ Configure your Helm commands in
tool-config.yml
- ๐ Run the test โ donezo!
We install Rancher using:
--set tls=external
Because ACM certs are already there, TLS is handled. No drama. Just Rancher ๐ฎ๐
This repo helps you:
- ๐ Deploy 3-node RKE2 HA clusters with Terraform
- ๐ง Auto-configure each node & wire them up over a secure ALB
- ๐ Use AWS ACM for certs โ no cert-manager required!
- โ๏ธ Generate and execute a custom
install.sh
script to install Rancher in 1 command - ๐ Automatically inject the correct URL into each Helm command
- ๐ฏ All driven by a single test function, because... we love automation
Put your tool-config.yml
next to this README โ right at the project root:
.
โโโ README.md
โโโ tool-config.yml ๐งโโ๏ธ (put it here)
โโโ go.mod
โโโ terratest/
โ โโโ test.go
โโโ modules/
โ โโโ aws/
Run this to build everything (with timeout so it doesnโt hang forever):
go test -v -run TestHaSetup -timeout 60m ./terratest
๐ This will:
- ๐ Launch EC2s, ALBs, and Route53 DNS records
- ๐ Setup TLS with AWS ACM certs
- ๐ง Bootstrap and join all 3 nodes into RKE2
- ๐ Generate and execute a Rancher
install.sh
script in each HA folder - ๐ Automatically inject the correct URL into each Helm command
Rancher is now installed automatically during the setup process! The tool:
- ๐ Injects the correct URL into each Helm command
- ๐ Generates the install script for each HA instance
- ๐ Executes the script to install Rancher
This installs Rancher securely via ALB + ACM certs with TLS ๐
No cert-manager needed. No cluster pain. Just good vibes and cattle โจ๐
๐ก Note: The install scripts are still available in each
high-availability-X/
directory if you need to run them again or modify them.
When you're done, run cleanup:
go test -v -run TestHACleanup -timeout 20m ./terratest
๐ฅ This will:
- ๐จ Destroy all infra via Terraform
- ๐งน Clean up generated files and folders
- ๐งผ Leave your AWS nice and tidy
๐ Where to find available rke2 k8s versions:
๐จโ๐พ๐งโRKE2 v1.32.X Release Notes ๐จโ๐พ๐งโโ๏ธ
- The number of Helm commands under
rancher.helm_commands
must match thetotal_has
value - Each Helm command will be used for a specific HA instance (first command for first instance, etc.)
- You can customize each Helm command with different parameters (bootstrap password, version, etc.)
- The
hostname
parameter in each Helm command will be automatically replaced with the correct URL- You can leave it blank, use a placeholder, or include your own value (it will be overridden)
- The tool will validate that the number of commands matches
total_has
and fail with an error if they don't match - The install script is automatically executed for each HA instance during setup
aws:
rsa_private_key: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
rancher:
helm_commands:
- |
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=placeholder \
--set bootstrapPassword=your-password \
--set tls=external \
--set global.cattle.psp.enabled=false \
--set rancherImageTag=v2.11.0 \
--version 2.11.0 \
--set agentTLSMode=system-store
- |
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=placeholder \
--set bootstrapPassword=your-password \
--set tls=external \
--set global.cattle.psp.enabled=false \
--set rancherImageTag=v2.11.0 \
--version 2.11.0 \
--set agentTLSMode=system-store
k8s:
version: "v1.31.4+rke2r1"
total_has: 2 # Number of HA clusters to create (must match number of helm_commands)
tf_vars:
aws_access_key: "super-secret-key"
aws_secret_key: "super-secret-key"
aws_prefix: "xyz" # your initials, keep it short!
aws_vpc: ""
aws_subnet_a: ""
aws_subnet_b: ""
aws_subnet_c: ""
aws_ami: ""
aws_subnet_id: ""
aws_security_group_id: ""
aws_pem_key_name: ""
aws_route53_fqdn: ""
Each HA setup creates a folder like:
high-availability-1/
โโโ install.sh ๐ One-command Rancher installer
โโโ kube_config.yaml ๐ Your RKE2 kubeconfig
You're basically a Rancher wizard now ๐งโโ๏ธโจ
This tool was built to make Rancher HA setup fun, secure, and dead simple.
With Terraform, RKE2, and ACM doing the heavy lifting โ you just ride the Rancher wave ๐๐
Pull requests welcome. Questions welcome. Rancher users always welcome.
Happy HA'ing! ๐๐ฎ๐ซ
๐ Built with Go, Terraform, and Rancher love.