I rewrote in Crystal my tool to quickly create Kubernetes clusters in Hetzner
This is my first project in Crystal and I love it already! It's syntax is lovely - similar to Ruby's - and it's FAST!
I would appreciate any feedback anyone might have - if you are a Kubernetes user as well as a Hetzner customer, please give it a try and let me know what you think, if you encounter any issues etc.
During my tests I was able to create a cluster with highly available control plane (3 masters behind a load balancer) and 5 nodes in multiple regions in just *3 minutes*. This is the total time to create the resources (servers, firewall, load balancer, private network), deploy Kubernetes to all the nodes, install some stuff required to provision load balancers and persistent volumes out of the box, and install an upgrade controller to easily upgrade the Kubernetes version (I use k3s as Kubernetes distro). I don't think there is a faster way to create a production Kubernetes cluster!
Do you have Kubernetes clusters in Hetzner already? If yes, which tool did you use to create them? Would be interested to know more about alternatives people are using.
48 comments
[ 2.8 ms ] story [ 94.7 ms ] threadIt uses MicroOS for rolling releases and auto-upgrades for less maintenance. I'm quite happy with it so far, and I like that it integrates with terraform.
[0] https://github.com/kube-hetzner/terraform-hcloud-kube-hetzne...
So, yes, it absolutely matters which OS you use, of course depending on your threat model and tolerance for "no, you don't get to ssh onto a Node and do whateverthehell you want"
However there is a gotcha. There are nearly infinite ways to setup your Pulumi codebase and there is no real prescribed structure outside of "create stacks". This can lead to a lot of time spent in architecting / implementing / testing different structures and abstractions which are not really a thing with Terraform. This can take time and can lead to refactors if you are not extremely intentional with your design.
- 3 masters with 3 cores and 4 GB of RAM each - load balancer for the masters (for the Kubernetes API) - 3 workers with faster AMD CPUs and 4 cores/8GB of RAM - around 200GB of storage in persistent volumes
I think it costs around 60-70 euros per month total! I can't remember the exact amount because I have many things with Hetzner and do tests creating and deleting stuff all the time so my bill is rather long lol.
Hetzner is very cheap, but I can voice for the performance and reliability as well. It's a very good provider and I highly recommend them. Now they even have 2 locations in the USA!
The tool simply requires a small YAML config file and creates and configures everything that you need to get a fully functional cluster in a few minutes. It creates all the infrastructure resources (servers etc), it deploys kubernetes on all the nodes, and then installs some software that allows you to provision both load balancers and persistent volumes. It also installs a controller that makes upgrading to a new version easier.
What the tool does not install is other apps, because this would be too opinionated and depends from cluster to cluster.
In terms of operators I have an idea for an operator but it would be very specific to our infrastructure and backend apps at work.
https://robot.hetzner.com/doc/webservice/en.html#preface
https://docs.hetzner.com/robot/dedicated-server/robot-interf...
My current setup is also on Hetzner. 1 master and 3 worker nodes. Managed by Rancher and I use Longhorn (also from Rancher Labs) for storage. It runs stable for two years now. But looking for a simpler solution, so I looked into k3s and k0s last week -- will also look into your tool ;-).
For backups I just use Velero. It can back up any kind of volumes with the Restic integration, and it has been rock solid for years for me.
In the past I've used Longhorn, Rook, OpenEBS and others but really, in Hetzner Cloud just use their volumes. It's much more reliable than those software solutions in my experience and performance is also a lot better.
I used Jamis Buck's book The Ray Tracer Challenge[1] as a fun kind of way to learn the language and ended up learning a good chunk of the language as a result.
My biggest complaint is just that it's not more popular - it's ecosystem is pretty web developer-centric and I'd personally love to see it used for more things outside of that.
[1] https://pragprog.com/titles/jbtracer/the-ray-tracer-challeng...
Another kubernetes installer. I think there's one Kubematic or similar already for Hetzner.
I'm going to try this and be possibly contribute back.
Few questions:
Why k3s why not k0s? What about cluster upgrades? Are they covered?
I'm probably going to setup a staging environment but can anyone suggest me a good CI/CD for Kubernetes? How about GitHub actions?
Secondly, I need to run databases lots of them some in range of 500 GB or so and backup/restore is important. Any suggestions there?
Yes cluster upgrades are covered with the "upgrade" command, as described in the REAME. I use the Rancher's System Upgrade Controller for this, which makes rolling upgrades very easy and super quick.
Github Actions is perfectly fine, it's what I use both for personal stuff and at work.
For the database, are you planning to host it in Kubernetes? Depending on the database type there may be an operator that can handle backups easily for you. For example for Postgres I have used the Zalando operator which does this and there is a newer one called CloudNativePG which might be even better. What kind of databases are they?
Yes. I use ClusterAPI[1] with the cluster-api-provider-hetzner[2] & Talos[3] (and Talos' cluster-api components) for that.
[1]: https://cluster-api.sigs.k8s.io/user/quick-start.html
[2]: https://github.com/syself/cluster-api-provider-hetzner
[3]: https://talos.dev
The most challenging part to me is setting up the disk encryption using LUKS, it requires a few manual steps.