Live data from Hacker News

We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

blog.mikoto.io

61–70 of 74 posts

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#61
post #53

Earlier quoted context omitted.

You need 3 nodes for a high availability control plane if you’re managing the Kubernetes control plane yourself. With GKE, the control plane is totally managed by Google Cloud, things like etcd etc are not running on any of your instances. It’s fine to have just 1 compute node (like the before state), or to put all the k8s control plane on a single node (like the after state) if you don’t need high availability.

interesting thanks, do you know if AWS offers something like that as well?

I think the comparable product is AWS EKS (Elastic Kubernetes Service)

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#62

As an SRE who’s moved between a few companies recently, I’ve noticed a trend towards simpler infrastructure options rather than k8s. Most places I interviewed at used AWS with just fleets of EC2s managed through ASG and instance refresh. Deployments are no downtime. It’s pretty nice and if you want to run with docker on the host instances you can but you can also just install the application using systemd.

How do you build ec2's? Funny thing is, everyone will have their own answer. Few will look alike. It's maybe simpler, but also bespoke. There's different definitions of simpler. I've rarely felt like folk's have a great grasp when they cobble together a bunch of options. Things that maybe one engineer started as a simple project 5 years ago grow and sprawl. They rarely stay simple. What this team gets out of the box…

EC2s are provisioned with Terraform or if you want to bypass that, click-ops. Nothing custom is needed. You can define a small shell script that is known as userdata that runs when the EC2 boots. That's standard and used everywhere that EC2s are used.

If you want more customization - again not necessary - you can build via Packer. The thing is, you have to do that anyways with Docker or whatever your container runtime happens to be. Docker images need patches as well if you install dependencies like openssl, libpql, etc.

ArgoCD - ArgoCD is great but it's something that has to be separate managed and comes with a database, UI layer, etc. and it's own set of permissions. The whole point of ArgoCD is to have deployments specifically around GitOps for container-based applications. Unnecessary if you don't have K8s.

Load balancers are simpler with ALBs and route directly to the auto-scaling groups. Traeffik is something that you need to manage. Also, K8s typically requires the use of external load balancers to work in the cloud as it is which means there's a layer of complexity that was introduced. Typically, K8s through the External Load Balancer Controller will provision the LB and attach targets. So it adds complexity. Traeffik isn't free, you are paying for the compute in your cluster which has the overhead of the control plane.

Let's Encrypt is another layer of complexity that has to be managed. AWS has ACM which can dynamically create and renew your certifications without you having to do anything.

K8s as a cluster needs to be managed and introduces significant breaking API changes across minor versions (1.23-1.24, etc.). Postgres managed as a stateful application also breaks some of the benefits of K8s in that it needs to be managed as a StatefulSet rather than as a ReplicaSet which means you likely need different deployment mechanisms to avoid destroying it accidentally.

Ironically, this architecture doesn't need any customizations at all. You can provision it with a few modules in Terraform or you can click ops the entire thing. K8s on the other hand, requires pretty constant attention. You've now introduced the management of the cluster, the building of the image, management of ArgoCD, Traeffik as well as external load balancers.

Basically: - Route53 for domain management

- ACM for cert management

- EC2s for LBs

- ASGs to manage EC2s

- Small shell script within userdata to configure the host vm

- RDS if you need a database

Avoiding the operational and actual costs of K8s.

I think that there are compelling reasons to use K8s:

- Lots of smaller services that need to interface with each other

- Product is deployed to multiple clouds or in a hybrid setting

- Infrastructure team has deep expertise in K8s

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#63

Earlier quoted context omitted.

How do you build ec2's? Funny thing is, everyone will have their own answer. Few will look alike. It's maybe simpler, but also bespoke. There's different definitions of simpler. I've rarely felt like folk's have a great grasp when they cobble together a bunch of options. Things that maybe one engineer started as a simple project 5 years ago grow and sprawl. They rarely stay simple. What this team gets out of the box…

EC2s are provisioned with Terraform or if you want to bypass that, click-ops. Nothing custom is needed. You can define a small shell script that is known as userdata that runs when the EC2 boots. That's standard and used everywhere that EC2s are used. If you want more customization - again not necessary - you can build via Packer. The thing is, you have to do that anyways with Docker or whatever your container runtim…

I think you'd spend longer just figuring out terraform, step 1, than you would doing every single piece of this blog post.

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#65
post #15

I should write a blog about how I saved the same amount in absolute terms by turning off the stuff i forgot is running in the cloud. Side note: the anime girls all over is kind strange. Like the header is giant cartoon tits? Why?

I use AI-generated anime girls for article covers because I'm a weeb and it makes the rather-thick wall of text slightly more bearable.

[deleted]

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#66
post #7

It's wild to me that we are talking about a site running on a single 2 core VPS costing $15/mo and the developer didn't stop to consider that maybe they don't need Kubernetes for this. Like...just run your damn services on the box like we've been doing since web hosting first became a thing.

I've said it a few times before: k8s is such a distraction for so many startups I've been in (~5). All of them fall into the same trap: write entire arch around k8s and then not really invest the engineering into building it out fully. Instead they all seemed to settle on "hey this works" which kicks off the technical debt receipt printing. In all of them fixing things often went like this... * A: XYZ is broke. * B:…

Many startups would also be fine with some serverless container solution (AWS Fargate, Google Cloud Run, etc.) It doesn't fit all applications, but when it does, it's generally less overhead than K8s, both operationally and $ wise.

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#67

Earlier quoted context omitted.

How do you build ec2's? Funny thing is, everyone will have their own answer. Few will look alike. It's maybe simpler, but also bespoke. There's different definitions of simpler. I've rarely felt like folk's have a great grasp when they cobble together a bunch of options. Things that maybe one engineer started as a simple project 5 years ago grow and sprawl. They rarely stay simple. What this team gets out of the box…

EC2s are provisioned with Terraform or if you want to bypass that, click-ops. Nothing custom is needed. You can define a small shell script that is known as userdata that runs when the EC2 boots. That's standard and used everywhere that EC2s are used. If you want more customization - again not necessary - you can build via Packer. The thing is, you have to do that anyways with Docker or whatever your container runtim…

Yep. What you describe is how we were doing things 10 years ago!

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#68
post #4

48.08 USD per month on a single-node GKE cluster w/ 2 cores 4 gigs -> 15.34 USD per month Hetzner VPS w/ 4 cores 8 gigs.

48 seems really low to me, I've never seen a k8s cloud cluster for less then 100-150 a month on the very low end, also doesn't take egress into account how do you even run a k8s cluster "on 2 cores 4 gigs", don't you need at least 3 nodes?

If your app needs 2 cores and 4 gigs RAM, why are you running it on a cluster in the first place? That "cluster" is going to have more resources going to overhead/management than running the application itself.

Re: We cut costs by 70% by moving from GCP and CockroachDB to Hetzner and PostgreSQL

#70

Earlier quoted context omitted.

For me, the main benefit of Kubernetes is declarative deployments. You can have the entire deployment automated through this and GitHub actions, without much fiddling with the production environment manually. I know, it's overkill and I don't like it that much either, but it's the industry standard.

Use docker compose or ansible for this scenario.

If I have to choose I’d rather learn k8s than ansible.
Post reply on HN