Linux Misc

Migrating From VPS To Kubernetes

I started with a typical WordPress hosting service back in 2017 with the plan of having a website for my YouTube channel.

Being the nerd I am , it didn't take long for me to migrate to Digital Ocean & start building my own VPC server hosting WordPress. You can still checkout the old version of my website here.

During this process, I got to learn a lot in setting up, configuration, maintenance and the do's and don'ts of running a production Linux server.

While I started to dip my toes into content creation for Twitter & YouTube, open-source on GitHub, and my personal projects I had less & less time to maintain my Linux servers. This resulted in, me neglecting to do routine tasks to my server 🤷‍♂️

I was already using Docker (specifically docker-compose) to run different services on the server, but managed hosting for Docker containers with Docker Compose or Docker Swarm was scarce 🤏

✅ The Solution

Kubernetes is primarily used for scaling Docker containers. It is also a tool meant to be used in production. Managed Kubernetes hosting services are provided by almost all big players like Google Cloud, Azure, AWS etc.

All you need to do is write YAML files to define exactly the services you want to run and they'll do the chores for you 👌

No need to manage firewall, no updating the server, no updating Docker images. Just bliss ✨

I wanted to try Linode for sometime now, so I migrated to LKE (Linode Kubernetes Engine) which is their managed Kubernetes service.

🧳 The Process

Thankfully 😌 all of the software I develop & use were already available to be used as Docker images in DockerHub.

All I had to do was learn the concepts & quirks of Kubernetes and the syntax of Kubernetes YAML files to migrate my docker-compose.yml into Kubernetes config files.

If a software you're using is not available as a Docker image, then you will need to build one yourself and host it in DockerHub, to be able to use it with Kubernetes.

👎 The Drawbacks

Pricing is the biggest drawback in my opinion.

Using Docker Compose required only one VM but Kubernetes requires at least 3 VMs to get started 🙆‍♂️ in production.

This increases the cost to double while providing no extra computation capacity. Adding up additional costs like LoadBalancers, Storage Volumes etc. make it almost 3 times of what it used to be when maintaining my own VPC server.

Other than that having full control over the machine allows you to do whatever you want like writing Bash scripts, creating services, timers and a lot more... That is not so simple when you're on managed Kubernetes.

⚡ Conclusion

There are many ways to reduce the maintenance required to run a Linux server and certainly this isn't the best way.

If you're someone who doesn't like spending a lot of money to get quality maintenance & reliability, then hiring a freelance sysadmin to manage your server is probably a better option 💡

With that being said, if you want to learn Kubernetes & keep that skill up to date, running your own Kubernetes cluster is the best way to do it 🙌

Thank you 😊