The Hetzner Provider for Managed Kubernetes utilizes Hetzner Cloud to set up Kubernetes clusters. This provider automates the management of essential cloud components on Hetzner, enabling the creation of scalable and production-ready Kubernetes clusters. With its competitive pricing, Hetzner is an advantageous choice for users seeking to optimize cloud expenses compared to larger hyperscalers such as AWS, Azure, and GCP.
hetzner-mk8s-example
.Security
in the left sidebar, then proceed to API tokens
.Generate API Token
.Read & Write
permissions to the token and copy it.Secrets
in the left sidebar and then select New
.Opaque
as the secret type and name it hetzner-mk8s-example
.hetzner-mk8s-example
on Hetzner:Networks
in the left sidebar.Create Network
.Firewalls
in the left sidebar.Create Firewall
.Security
in the left sidebar.SSH Keys
and click on Add SSH Key
.Note: The steps above can be automated using the API or CLI tools of Hetzner and Control Plane.
hcloud context create hetzner-mk8s-example
and insert the API key
from the previous step.network
, and optionally the firewall
and the ssh-key
created in the previous step using the hcloud CLI.hcloud network list
.hcloud firewall list
.hcloud ssh-key list
.hetzner-mk8s-example.yaml
YAML manifest with actual values from above. Customize the file
as needed. Replace the placeholders for firewallId
, networkId
, and sshKey
.copykind: mk8sname: hetzner-mk8s-exampledescription: An example of Hetzner mk8stags: {}spec:provider:hetzner:dedicatedServerNodePools: []firewallId: '1111111'image: ubuntu-22.04networkId: '2222222'nodePools:- name: generallabels:environment: hetzner-mk8s-examplemaxSize: 1minSize: 4serverType: cpx31taints: []region: hel1sshKey: '333333'tokenSecretLink: //secret/hetzner-mk8s-exampleaddOns:dashboard: {}localPathStorage: {}awsWorkloadIdentity: {}firewall:- description: DefaultsourceCIDR: 0.0.0.0/0version: 1.28.2
This example creates a Managed Kubernetes cluster in Hetzner Cloud with the following configurations:
gcp-us-east1
location.
Placing worker nodes close to the control plane is recommended for optimal performance.Default
rule, allowing public access to the Kubernetes API. It is advisable to
restrict API access to a known IP range for security purposes.general
node pool, scaling on-demand between 1 and 4 nodes.Create the Cluster: Deploy the hetzner-mk8s-example
cluster by applying the manifest.
hetzner-mk8s-example.yaml
file using the cpln apply >_
option in the upper right corner.cpln apply -f hetzner-mk8s-example.yaml --org YOUR_ORG_HERE
.Wait until the cluster is initialized.
cpln mk8s kubeconfig hetzner-mk8s-example -f /tmp/hetzner-mk8s-example-conf
.kubectl
: Use the obtained kubeconfig file by running export KUBECONFIG=/tmp/hetzner-mk8s-example-conf
for the current shell session.Kubernetes
in the left sidebar panel and click on Open
under Dashboard
for the cluster hetzner-mk8s-example
.