Skip to content

๐Ÿฎ Easily spin up Rancher HA clusters on AWS with RKE2, Terraform, and Go. One config, one command, full automation! ๐Ÿš€

Notifications You must be signed in to change notification settings

brudnak/ha-rancher-rke2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฎโœจ RKE2 Rancher HA Bootstrapper โœจ๐Ÿฎ

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. ๐ŸŒˆโšก๏ธ๐Ÿš€


๐Ÿ’ก TL;DR โ€“ Why This Rocks

โœ… No Cert Manager needed โ€” SSL is done via AWS ACM ๐Ÿ™Œ
โœ… Secure by default โ€” HTTPS from the jump ๐Ÿ”
โœ… All you gotta do:

  1. ๐Ÿ› ๏ธ Tweak the generated install.sh (if you even want to...)
  2. ๐Ÿš€ Run it โ€” donezo.

We install Rancher using:

--set tls=external

Because ACM certs are already there, TLS is handled. No drama. Just Rancher ๐Ÿฎ๐Ÿ’•


๐Ÿง  What This Repo Does

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 a custom install.sh script to install Rancher in 1 command
  • ๐ŸŽฏ All driven by a single test function, because... we love automation

๐Ÿ“ฆ Directory Layout

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/

๐Ÿงช Spin It Up (HA Setup)

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
  • ๐Ÿ“ Drop a ready-to-run Rancher install.sh in each HA folder

๐Ÿฎ Install Rancher

Navigate to your HA cluster directory (like high-availability-1/) and run:

./install.sh

This installs Rancher securely via ALB + ACM certs with TLS ๐Ÿ”’
No cert-manager needed. No cluster pain. Just good vibes and cattle โœจ๐Ÿ„


๐Ÿ’ฃ Tear It Down (Cleanup)

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

๐Ÿงพ Sample tool-config.yml

๐Ÿ”Ž Where to find available rke2 k8s versions:

๐Ÿ‘จโ€๐ŸŒพ๐Ÿง™โ€RKE2 v1.32.X Release Notes ๐Ÿ‘จโ€๐ŸŒพ๐Ÿง™โ€โ™‚๏ธ

aws:
  rsa_private_key: |
    -----BEGIN RSA PRIVATE KEY-----
    -----END RSA PRIVATE KEY-----

rancher:
  bootstrap_password: ""
  image_tag: "v2.11.0"
  version: "2.11.0"

k8s:
  version: "v1.31.4+rke2r1"

total_has: 2  # Number of HA clusters to create

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: ""

๐Ÿ“ Output Example

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 ๐Ÿง™โ€โ™€๏ธโœจ


๐Ÿงก Final Notes

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.

About

๐Ÿฎ Easily spin up Rancher HA clusters on AWS with RKE2, Terraform, and Go. One config, one command, full automation! ๐Ÿš€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published