Repolode
mysticaltech

mysticaltech/terraform-hcloud-kube-hetzner

A Terraform/OpenTofu module that deploys a production-oriented Kubernetes cluster (k3s or RKE2) on Hetzner Cloud from a single configuration.

Stars
3,942
Forks
558
Open issues
16
Last commit
8 days ago

What is it?

Kube-Hetzner is a Terraform and OpenTofu module that provisions a Kubernetes cluster on Hetzner Cloud. It runs k3s by default, with RKE2 as an option, on openSUSE Leap Micro nodes. The module sets up private networking, firewalls, CSI storage, ingress, certificate management, OS updates and Kubernetes upgrades as part of the deployment.

Clusters are defined in a kube.tf file. Users choose control-plane and agent node pools, multiple locations, and networking options such as Flannel, Calico or Cilium, including private-only NAT setups and Tailscale transport. A helper script creates the project folder and required OS images, and the project includes validation so invalid topologies fail at plan time.

The repository also ships documentation for day-2 operations, upgrades, backup and restore, and troubleshooting, along with examples and skills for AI coding assistants.

Key features

  • 01Deploys k3s or RKE2 clusters on openSUSE Leap Micro nodes.
  • 02Supports highly available control planes and multi-location node pools.
  • 03Integrates private networking, firewalls, CSI storage and ingress.
  • 04Offers Flannel, Calico or Cilium networking, including private-only NAT setups.
  • 05Includes Cluster Autoscaler nodepool support and guided upgrade workflows.

Use cases

  • Running a production-style Kubernetes cluster on Hetzner Cloud at low cost.
  • Setting up a small development cluster with a single control plane.
  • Managing cluster infrastructure as reviewable Terraform or OpenTofu code.

Quick start

  1. 1

    Install OpenTofu, kubectl and hcloud with Homebrew

    brew install opentofu kubectl hcloud
  2. 2

    Create a Hetzner Cloud project, a Read & Write API token and a passphrase-less SSH key

  3. 3

    Run the create script from the README to generate your project folder, kube.tf and the Leap Micro images

  4. 4

    Edit kube.tf, then initialize the project in your project folder

    tofu init --upgrade

Things to know

  • Works only with Hetzner Cloud, and deploying it creates paid cloud resources.
  • Requires Terraform or OpenTofu, Packer and an existing Hetzner Cloud account with an API token.

Topics

FAQ

What is terraform-hcloud-kube-hetzner?
A Terraform/OpenTofu module that deploys a production-oriented Kubernetes cluster (k3s or RKE2) on Hetzner Cloud from a single configuration. Kube-Hetzner is a Terraform and OpenTofu module that provisions a Kubernetes cluster on Hetzner Cloud. It runs k3s by default, with RKE2 as an option, on openSUSE Leap Micro nodes. The module sets up private networking, firewalls, CSI storage, ingress, certificate management, OS updates and Kubernetes upgrades as part of the deployment.
Is terraform-hcloud-kube-hetzner free to use? What license does it have?
terraform-hcloud-kube-hetzner is open source under the MIT license. Check the license terms before using it in commercial products.
Is terraform-hcloud-kube-hetzner still maintained?
Actively maintained. The last commit to terraform-hcloud-kube-hetzner was on Oct 30, 2026.
What can I use terraform-hcloud-kube-hetzner for?
Running a production-style Kubernetes cluster on Hetzner Cloud at low cost. Setting up a small development cluster with a single control plane. Managing cluster infrastructure as reviewable Terraform or OpenTofu code.
How do I install terraform-hcloud-kube-hetzner?
Install OpenTofu, kubectl and hcloud with Homebrew: brew install opentofu kubectl hcloud Create a Hetzner Cloud project, a Read & Write API token and a passphrase-less SSH key Run the create script from the README to generate your project folder, kube.tf and the Leap Micro images Edit kube.tf, then initialize the project in your project folder: tofu init --upgrade
Where can I get terraform-hcloud-kube-hetzner?
The source code and installation instructions are on GitHub: https://github.com/mysticaltech/terraform-hcloud-kube-hetzner

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects