A Terraform module to deploy a Kubernetes RKE cluster on Hetzner cloud
This repository has been archived on 2026-11-01. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • HCL 90%
  • Shell 10%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2020-08-21 11:29:19 +02:00
.github/ISSUE_TEMPLATE Add Issue templates for bug report and feature request. 2020-05-04 12:36:13 +02:00
files Refactor and enhance README. 2019-10-25 11:31:18 +02:00
test Add input/variable defaults to test. 2020-05-04 19:11:34 +02:00
.gitignore Initial commit. 2019-05-07 16:28:28 +02:00
.pre-commit-config.yaml Bump pre-commit-terraform to v1.30.0 2020-05-04 13:10:01 +02:00
main.tf Recording current state before merge to github 2020-08-21 11:05:17 +02:00
outputs.tf Fix duplicate outputs 2020-08-21 11:29:19 +02:00
README.md Writing the kube_config_cluster.yml is optional and documented in test. 2020-05-04 19:03:36 +02:00
variables.tf Merge branch 'ssh_key' 2020-04-14 15:50:12 +02:00
versions.tf Recording current state before merge to github 2020-08-21 11:05:17 +02:00

terraform-hcloud-rke

Terraform Module to deploy a Kubernetes Cluster using RKE Provider in Hetzner Cloud.

Usage

See test/main.tf for example usage of the module.

You might want to include the CSI driver for automatic provisioning of volumes by adding https://raw.githubusercontent.com/hetznercloud/csi-driver/v1.2.3/deploy/kubernetes/hcloud-csi.yml to addons_include variable. (Note: A configmap containing the api key needs to be added as well.)

Providers

Name Version
hcloud ~> 1.14
rke ~> 0.14

Inputs

Name Description Type Default Required
addons_include List of URLs to yaml resources to include eg. install Kubernetes Dashboard list(string)
[
"https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml",
"https://gist.githubusercontent.com/superseb/499f2caa2637c404af41cfb7e5f4a938/raw/930841ac00653fdff8beca61dab9a20bb8983782/k8s-dashboard-user.yml"
]
no
docker_version Docker version to install on the nodes string "18.06.2" no
image Image string "ubuntu-16.04" no
nodes Map of node objects including their name, role and server_type
map(object({
name = string,
role = list(string),
server_type = string,
}))
{
"master1": {
"name": "master1",
"role": [
"controlplane",
"etcd"
],
"server_type": "cx21"
},
"worker1": {
"name": "worker1",
"role": [
"worker"
],
"server_type": "cx21"
}
}
no
ssh_private_key_path SSH private key path string "~/.ssh/id_rsa" no
ssh_public_key_path SSH public key path string "~/.ssh/id_rsa.pub" no

Outputs

Name Description
api_server_url RKE k8s cluster api server url
ca_cert RKE k8s cluster CA certificate
client_cert RKE k8s cluster client certificate
client_key RKE k8s cluster client key
kube_config_yaml RKE k8s cluster kube config yaml
this List of node objects

Where to go further?

After deploying your Kubernetes Cluster you can login to the Kubernetes Dashboard using the following steps:

  1. Get Kubernetes Dashboard token
kubectl --kubeconfig kube_config_cluster.yml -n kube-system describe secret $(kubectl --kubeconfig kube_config_cluster.yml -n kube-system get secret | grep admin-user | awk '{print $1}') | grep ^token: | awk '{ print $2 }'
  1. Set up kubectl proxy
kubectl --kubeconfig kube_config_cluster.yml proxy"
  1. Login with the token copied in the step before at http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Contributing

We encourage you to contribute to this project in whatever way you like!

Report bugs/feature requests in the issues section.

When contributing to this repository, please first discuss the change you wish to make via issue with the owners of this repository before making a change.

Versioning

Semantic Versioning 2.x

In a nutshell:

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Maintainer

https://github.com/brotandgames