terraform module to setup rke(ha) on hetzner hcloud.
This project is highly inspired by alexzimmer96/rancher-hcloud, but separates the setup of the rke cluster from the helm based rancher setup, because of flexibility and k8s best practices.
The rancher-hcloud terraform module can be found here.
Go to example folder, adjust main.tf and run:
terraform init
terraform apply
After the commands have been executed (takes a few minutes), there should be
a kubeconfig.yaml
in the local directory, which can be used to access the
cluster.
Test your cluster:
export KUBECONFIG=$(realpath ./kubeconfig.yaml)
kubectl get po --all-namespaces
Name | Version |
---|---|
hcloud | 1.31.0 |
rke | 1.2.3 |
Name | Version |
---|---|
hcloud | 1.31.0 |
local | 2.1.0 |
rke | 1.2.3 |
No modules.
Name | Type |
---|---|
hcloud_load_balancer.rke_lb | resource |
hcloud_load_balancer_network.rke_lb_network_registration | resource |
hcloud_load_balancer_service.rke_lb_http_service | resource |
hcloud_load_balancer_service.rke_lb_https_service | resource |
hcloud_load_balancer_service.rke_lb_k8s_service | resource |
hcloud_load_balancer_target.rke_lb_targets | resource |
hcloud_network.kubernetes_internal_network | resource |
hcloud_network_subnet.rke_subnet | resource |
hcloud_server.rke_nodes | resource |
hcloud_server_network.rancher_node_subnet_registration | resource |
hcloud_ssh_key.rke_ssh_key | resource |
local_file.kube_config_server_yaml | resource |
rke_cluster.rke_cluster | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
hcloud_secret | The token that is used to interact with the Hetzner Cloud API. | string |
n/a | yes |
hcloud_ssh_key_private | ssh private key you want to use register on your Hetzner Cloud machines. | string |
n/a | yes |
hcloud_ssh_key_public | ssh public key you want to use register on your Hetzner Cloud machines. | string |
n/a | yes |
instance_count | Number of instances that will be deployed. Should be a odd number (1, 3, 5, etc.). | number |
3 |
no |
instance_prefix | The prefix that comes before the index-value to form the name of the machine. | string |
"rke" |
no |
instance_type | Hetzner instance type that is used for the machines. You can use the Hetzner Cloud CLI or browse their website to get a list of valid instance types. | string |
"cx11" |
no |
instance_zones | All zones over which the nodes are distributed. | list(string) |
[ |
no |
lb_location | Location of the Load Balancer. | string |
"nbg1" |
no |
lb_name | Name of the Load Balancer that is placed in front of your instaces. | string |
"rke-lb" |
no |
lb_type | Hetzner Load Balancer type. You can use the Hetzner Cloud CLI or browse their website to get a list of valid instance types. | string |
"lb11" |
no |
private_network_name | Name of the private network that is created for your nodes. | string |
"kubernetes-internal" |
no |
Name | Description |
---|---|
kube_config_yaml | RKE k8s cluster kube config yaml |
kubernetes_api_server_url | RKE k8s cluster api server url |
kubernetes_ca_crt | RKE k8s cluster CA certificate |
kubernetes_client_cert | RKE k8s cluster client certificate |
kubernetes_client_key | RKE k8s cluster client key |
lb_address | HCloud loadbalancer address |