Pirobits
Blog@bypirob

Serverless vs K8S vs VPS: Which is the Best Option to Deploy Your Project?

alberto avatar
infrastructure
Alberto Sola · 5/27/2024 · 4 min

Deploying a project may seem complicated, but it's actually the easiest and most fun part. Professionally, I manage infrastructure, so I want to show you what options exist and why choosing a VPS is the best.

Today, there are many platforms that make it easy to deploy your project, and in general, they are very convenient as they save you from needing to know or configure infrastructure. On the other hand, they have some disadvantages such as cost, which is generally high if your project starts to get a lot of traffic, or encountering problems that you can't solve because you don't have access to the infrastructure. Ultimately, it’s something you have to evaluate based on your needs and knowledge.

If you need to quickly test a prototype of your project to see if it works, then I recommend starting with one of these platforms because they allow you to test your project in just a few minutes. Otherwise, I recommend trying to set up a VPS server, as it’s not that difficult and is much more cost-effective.

In general, I’ve noticed that, except for some people who enjoy learning and experimenting with servers, many developers don't seem very interested in infrastructure. Here’s a question for you: do you like configuring infrastructure? I encourage you to answer the following form to share your experience.

If you want to deploy a new project you’re working on, I usually consider the following four options. I’ll explain each one and briefly outline the pros and cons.

Serverless

I’d say this is the current trendy option. There are multiple cloud services like AWS Lambda and Cloudflare Workers on which other companies have built their services, for example, Vercel which seems to work with AWS Lambda. I love these services for solving specific use cases, but I wouldn't recommend them for base use due to the associated complexity or volume costs, which can be surprising.

Cloud Services

Cloud services seem like an excellent option because they allow you to manage infrastructure, have backups, improve scalability... whatever you need with a click and without worrying. The main problem is the cost difference compared to other services. If they truly add value and are cost-effective, use them; if not, keep reading. My options here are usually Amazon Web Services and Google Cloud Platform. There's also another interesting company I haven't tried yet: fly.io.

Kubernetes

It's a perfect service for large teams managing multiple projects. In the end, a cloud container environment guarantees stability, abstracts parts of the infrastructure but has high management and knowledge costs. I love Kubernetes, I use it daily, but if I could simplify the stack, I’d go for a VPS environment to reduce the complexity of managing a cloud cluster with auto-scaling, as it involves many moving parts: continuous version updates, container metrics (HPA, KEDA), node metrics (Karpenter), node groups, manifests... among many other things.

VPS

This is the simplest, most affordable, and most practical option. It’s what I’ve been using for my personal projects in recent years. You configure a server once, deploy your project, automate the process, and voilà. You only need to update the server occasionally and make some adjustments when needed. Similarly, if your application's traffic scales, you can always scale it vertically or add redundancy with a load balancer and a couple of machines. It’s true that this option requires some server management knowledge and that not everyone may have the interest or time to manage it.

Here, I’d like to know your opinion on this topic, which option would you choose and why? As mentioned earlier, I’ve created a short form where you can share your opinion on the topic.

As I always say, your needs or those of your company depend on many factors that may not be trivial and may be difficult to find answers in a single post, but I always insist on the same thing. I increasingly like simple, efficient things that are easy to manage so I can iterate quickly. If I have to spend my time managing a Kubernetes cluster, and I'm alone, I might be doing something wrong as my time should be focused on other operations.

If you found this article useful I would appreciate if you subscribe to my newsletter. You will receive exclusive quality content and you will also help me enormously. Each subscription supports the work I do and allows me to learn more about the topics you are interested in, so that I can improve the knowledge I share with you.


Recent posts