This project aims to show how an unexpensive kubernetes cluster can be set up in a cloud provider such as Hetzner.
The cluster runs on 2cpu/2gb nodes that cost about $5 monthly on their Virginia based datacenter and also includes a load balancer that costs about the same.
I have used Terraform to manage nodes and networking and FluxCD for continuous delivery. More details below.
I've decided to use K3S (instead of kubeadm to set up the cluster) since the idea was for this cluster to be inexpensive and K3S would allow me to get the most out of the VPS nodes.
Terraform manages a private network with a subnet and the master node, under workspace staging (doesn't mean that it actually is a staging environment just a name for it).
Flux manages Kubernetes resources and apps. My own personal site (https://marianobe.cc/) is hosted here and gets deployed using a Github Action triggered from its own repository.
The public ip address you see of my site is a Load Balancer provided by Hetzner that was automatically set up as part of the Istio Ingress infra.
Certificates are managed by Cert-Manager and using Letsencrypt.
All in all not bad for a whole cluster running on 2gb, although things look a bit tight and I'll be adding worker nodes + autoscaler shortly:
Open an SSH Socks proxy to the master node and use kubectl:
$ ssh -D 6443 cluster@<master node public ip>
# (kubectl config already set by direnv)
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
master-node Ready control-plane,master 6m49s v1.30.5+k3s1
Alternatively use an app such as Secure Pipes or autossh to keep the proxy connection open.
- Add more (worker) nodes + autoscaler. Worker nodes templates would be defined by Terraform with count = 0 and Autoscaler should decide how many are needed.
- Add an Airbyte or Dagster pipeline to show how these workflows can be implemented and scale using inexpensive computing power.