Getting Started with kOps on Hetzner Cloud

WARNING: Hetzner Cloud support on kOps is currently in alpha, meaning it is subject to change, so please use with caution. The original issue ticket is #8983.

Requirements

  • kOps version >= 1.24
  • kubectl version >= 1.23
  • Hetzner Cloud account
  • Hetzner Cloud token
  • SSH public and private keys
  • S3 compatible object storage (like MinIO)

Environment Variables

It is important to set the following environment variables:

  1. export KOPS_FEATURE_FLAGS=Hetzner
  2. export HCLOUD_TOKEN=<token>
  3. export S3_ENDPOINT=<endpoint>
  4. export S3_ACCESS_KEY_ID=<acces-key>
  5. export S3_SECRET_ACCESS_KEY=<secret-key>
  6. export KOPS_STATE_STORE=s3://<bucket-name>

Some S3 compatible stores may also require to set the region:

  1. export S3_REGION=<region>

Creating a Single Master Cluster

In the following examples, example.k8s.local is a gossip-based DNS cluster name.

  1. # create a ubuntu 20.04 + calico cluster in fsn1
  2. kops create cluster --name=my-cluster.example.k8s.local \
  3. --ssh-public-key=~/.ssh/id_rsa.pub --cloud=hetzner --zones=fsn1 \
  4. --image=ubuntu-20.04 --networking=calico --network-cidr=10.10.0.0/16
  5. kops update cluster my-cluster.example.k8s.local --yes
  6. # create a ubuntu 20.04 + calico cluster in fsn1 with CPU optimized servers
  7. kops create cluster --name=my-cluster.example.k8s.local \
  8. --ssh-public-key=~/.ssh/id_rsa.pub --cloud=hetzner --zones=fsn1 \
  9. --image=ubuntu-20.04 --networking=calico --network-cidr=10.10.0.0/16 \
  10. --node-size cpx31
  11. kops update cluster --name=my-cluster.example.k8s.local --yes
  12. # validate a cluster
  13. kops validate cluster --name=my-cluster.example.k8s.local
  14. # delete a cluster
  15. kops delete cluster --name=my-cluster.example.k8s.local --yes
  16. # export kubecfg
  17. # See https://kops.sigs.k8s.io/cli/kops_export_kubeconfig/#examples.
  18. # update a cluster
  19. # See https://kops.sigs.k8s.io/operations/updates_and_upgrades/#manual-update.

Features Still in Development

kOps for Hetzner Cloud currently does not support the following features:

Next steps

Now that you have a working kOps cluster, read through the recommendations for production setups guide to learn more about how to configure kOps for production workloads.