Skip to content

scm2342/rke2-build-hetzner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform for rke2 on hetzner

1. Setup

create env file, e.g.:

export TF_VAR_clustername=CLUSTER
export TF_VAR_domain=YOURDOMAIN
export TF_VAR_hcloud_token=HETZNER_TOKEN_WITH_WRITE
export TF_VAR_api_token=HETZNER_TOKEN
export TF_VAR_rke2_cluster_secret=SOMESECRETTOJOINNODES

Then source it

source file

2. Initialize terraform

terraform init

3. Create cluster

terraform apply

Optional: Adjust number of workers in main.tf, check vars.tf

Now wait until load balancer is all green.

4. Setup kubectl

ssh -l root <anymasterip> cat /etc/rancher/rke2/rke2.yaml

Replace 127.0.0.1 of the output with either your domain that you point to the lb external ip, or with the lb external ip directly, and place to ~/.kube/config.

Check

kubectl get nodes

Releases

No releases published

Packages

No packages published

Languages