Kubernetes Investigation

Building a Bare Metal Kubernetes Cluster – Part 1 – Platform Evaluation & Cost Analysis

Motivation

Over the past few years I have had the pleasure of working with organisations that are using Kubernetes clusters from different cloud providers. AWS’ Kubernetes offering is EKS and Azure provide AKS. Both of these are largely similar and also have another thing in common; they are VERY expensive to run. If you are multi million dollar business with big profit margins then this is not a problem. However, if you are a start up or small business, these costs can be prohibitive in moving to a cloud hosted Kubernetes architecture.

A big benefit of the big two aforementioned cloud providers is that the Kubernetes control plane is managed on your behalf. This results in a cluster being able to be created very quickly with very little user input or knowledge of Kubernetes setup. The cloud providers also provide the Load Balancer for you, all configured and ready to go. With my developer hat on this is a big benefit as it allows me to focus on writing my application rather than setting up the cluster.

I have recently been working on a small project in my spare time and wanted a Kubernetes cluster to deploy my application to. My requirements are as follows:

  • Ability to deploy software components via Azure DevOps pipelines (YAML).
  • Two clusters; One for my DEV and UAT environments and a separate cluster for PROD.
  • Low costs as the project is yet to earn any revenue.

My initial requirements in terms of server specifications for each cluster are as follows:

  • Single master node – At least 4GB RAM and 2 CPUs
  • Two or more worker nodes – At least 16GB RAM and 4 CPUs

My preference when choosing a cloud provider would be Azure. This is mostly personal preference but I as my application is mostly .NET based, Azure seems the better fit. I also know that it is much simpler to integrate with Azure DevOps.

The pricing based on my requirements, at the time of writing, is a whopping $341 per month per cluster! That price would give me two virtual machines (workers) with a specification of 16GB RAM and 4 vCPUs per instance. The Azure specific instance is D4v3. For me to run two clusters, that would be $682 per month which is simply not viable.

On Premise Cluster

I decided to investigate building my own bare metal cluster as I had an old HPE ProLiant server that would be perfect for this. I may write a future post on this experience for anyone wishing to do the same as it was an interesting exercise. However, I never fully got the cluster perfectly working with a load balancer. The use of NodePort services will allow you to route traffic into the cluster to a particular node but this method provides no failover. MetalLB provide a nice load balancer implementation that I got working on my private network but I was never able to fully get the ingress of traffic from the outside world working correctly.

Hetzner Cloud

I came across Hetzner whilst building my on premise bare metal cluster. They have a really great guide to building a Kubernetes cluster on their hosted servers which helped me with my install. The guide also covers using MetalLB for load balancing. A link to the guide can be found in the Resources section below.

I started to investigate the services offered by Hetzner in more depth and found that they provide most of what is needed for a Kubernetes cluster at a fraction of the price of the main cloud providers. They have also recently launched a Load Balancer that can be used with Kubernetes.

I decided to price up a cluster running on Hetzner Cloud to get a comparison. My findings were as follows:

ComponentHetzner Size CodeDetailsPrice (Inc VAT)Quantity RequiredTotal
Master NodeCX214GB RAM, 2 vCPU, 40GB Local Storage€5.881€5.88
Worker NodeCX4116GB RAM, 4 vCPU, 160GB Local Storage€19.082€38.16
Load BalancerLB1125 Targets, 5 Services, 10 Certificates, 10,000 Connections, 20TB Outgoing Traffic€5.881€5.88

As you can see from the above, Hetzner offers a far cheaper option compared to the big cloud providers. For the same specification as Azure, I could build a cluster costing €49.92 per month! When converted to dollars that is approximately $57, an 83% saving!

It would appear that Hetzner was a winner in terms of cost so I decided to build a cluster and evaluate it suitability for running my project.

Check back for Part 2 in this series where I will explain how to build a cluster on Hetzner cloud.

Thanks for reading!

Resources

Install a Kubernetes cluster on cloud servers

MetalLB, bare metal load-balancer for Kubernetes

Pricing Calculator | Microsoft Azure

You may also like...

Popular Posts