Running Kubernetes in the cloud is powerful — but exposing control-plane and worker nodes directly to the internet is risky. This full IaC (Infrastructure as Code) shows a clean, maintainable way to deploy a Kubernetes cluster on Hetzner Cloud where all nodes live exclusively on a private network. sEvery infrastructure element is defined as code using Terraform (OpenTofu) and Kubespray config.
The setup consists of three layers:
Infrastructure (1-infra)
Platform (2-platform)
Applications (3-apps)
Clone the repo: https://codeberg.org/tessellative/k8s-hetzner-private-net.git
Follow the setup commands in staging order in the README.md files, starting at the root level.
The repo is nicely split:
This demo can be run behind a proper non-reserved domain with TLS certificates set up! Change and configure the following with your domain
This project is a great starting template for anyone who wants to run Kubernetes on Hetzner without exposing nodes publicly. It demonstrates good practices: separation of concerns, private networking and full automation.
Happy deploying! 🚀