In this article I describe how you can create a complete and production ready K3s Kubernetes cluster in Hetzner cloud in a few minutes. To do this we use the Vitobotta way as mentioned here:

Short step-by-step plan

We first create a config (as desired), which we pass with the Docker image. Next, the resources that you defined in the config are created in Hetzner cloud via the Hetzner API. These include the servers, private network, firewall, load balancer for the API server for HA clusters.

What else will be installed:

• K3s to the nodes

• Hetzner Cloud Controller Manager to provision load balancers

• Hetzner CSI Driver to provision persistent volumes using Hetzner's block storage

• Rancher System Upgrade Controller to make upgrades to a newer version of k3s easy and quick

Why Hetnzer cloud?

Hetzner Cloud is a cloud provider which offers a great service with the best performance/cost ratio in the market. With Hetzner’s Cloud Controller Manager and CSI driver you can provision load balancers and persistent volumes very easily.

Why K3s?

Because it uses much less memory and CPU, leaving more resources to workloads. It is also super quick to deploy because it’s a single binary. Using this tool, creating a highly available k3s cluster with 3 masters for the control plane and 3 worker nodes takes about a couple of minutes only.

Requirements before we start:

• Windows (11 in our case) with a Docker Desktop installed.

• Git GUI for creating SSH keys but you can also use Putty Gen.

• Powershell ISE (but should be installed by default on Windows)

• An account on Hetzner cloud.


Create a new project in Hetzner and an account api key. Save the key because we will need it for the create.yaml.

Create the following folders and files:

• C:\kluster

• C:\kluster\create.yaml

• C:\kluster\ssh

Start Git GUI en generate new SSH keys, save them in the ssh folder.


Note: the following create.yaml is an example, go to Vitobotta’s Github page for all options and other examples as well. For instance, you can determine yourself how many masters and workers you have.

If you want to create a High Available cluster you need at least 3 masters and 2 workers to be able to load balance. That is, if a master fails you can still access and use your cluster. The same applies for your workload, if you have applications running in the cluster, they will run on one of the 2 workers. If one fails, the other will take over so that your application is always up and running.

• K3s_version, you can run hetzner-k3s releases to get a list of all K3s versions. Note: If you plan to install Rancher, it does not support the latest k3s versions. If you try that anyway, you will see a message:

Release "rancher" does not exist. Installing it now.
helm : Error: chart requires kubeVersion: < 1.22.0-0 which is incompatible with Kubernetes v1.22.3+k3s1
At line:1 char:1
+ helm upgrade --install --namespace cattle-system --set hostname=ranch ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error: chart v1.22.3+k3s1:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

• As for the Instance_type, on this page you will find an overview of the type and costs to make a good choice.

hetzner_token: [your-hetzner-api-key]
cluster_name: [some-name]
kubeconfig_path: "./kubeconfig"
k3s_version: v1.22.3+k3s1
public_ssh_key_path: "~/.ssh/"
private_ssh_key_path: "~/.ssh/id_rsa"
verify_host_key: false
location: nbg1
schedule_workloads_on_masters: false
  instance_type: cpx21
  instance_count: 3
- name: small
  instance_type: cpx21
  instance_count: 2

Create cluster

Start Powershell ISE and run:

• cd C:\kluster Thereafter:

docker run --rm -it -v ${PWD}:/cluster -v ${PWD}/ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.4.8 create-cluster --config-file /cluster/create.yaml

Give it a few minutes so the cluster can be created. Finally a file is created:

• C:\kluster\kubeconfig

Copy it to:

• C:\Users\your-windows-user\.kube

And rename the file to “config”, so without file extension. Kubectl looks at this location for the config file with all keys.

And now?

You can use Powershell ISE to control your cluster. A next step could be installing an Ingress controller. I will write about this in another post.