Set up a Kubernetes cluster in under 5 minutes with Proxmox and k3s
Mihai Farcas
Posted on January 30, 2024
Introduction
In this blog post, we will explore how to quickly and easily add a new node to your Kubernetes cluster in under 5 minutes. I'll walk you through the process of setting up a compact mini PC and demonstrate how to integrate it seamlessly into your existing Kubernetes cluster. By following this guide, you'll be able to expand the capabilities of your cluster and gain valuable insights into the inner workings of cloud computing.
Video Version
Compact Mini PCs: A Cost-Effective Solution
First, let's take a look at the compact mini PC that I'll be using for this setup. These machines are not only affordable but also powerful enough to perform complex computing tasks. With their 8th Gen Core i7 processors, 16GB of RAM, and fast NVMe storage, these mini PCs offer exceptional performance while consuming minimal power. In fact, they draw only about 10 to 30 watts of power (depending on load), making them a budget-friendly alternative to cloud computing.
PRO Tip: There are a lot of great deals to be found on second hand Mini PCs
Why Choose Kubernetes?
Before I dive into the setup process, let's briefly discuss why Kubernetes is the platform of choice for building scalable and efficient applications. Kubernetes has gained immense popularity, especially in the enterprise world, due to its ability to streamline containerized application deployment and management. By learning Kubernetes, you can open up new career opportunities and gain a better understanding of the services cloud vendors provide.
Setting Up Your New Node
To add a new node to your Kubernetes cluster, I'll utilize Proxmox, a powerful tool for managing clusters of servers. Installing Proxmox is a straightforward process that can be completed by booting from a USB with the Proxmox ISO file. Once the installation is complete, you can go to the IP address that was assigned to the machine during installation on the port 8006 and you will be greeted by the Proxmox web UI.
If this is the first node, then you instead need to click on "Create Cluster".
Since I already have a cluster, I'll join this new machine to it. This is as simple as going to to the existing cluster's Proxmox web UI, click on Datacenter -> Cluster -> Join Information. Copy the join information, go back to the new node's Proxmox web UI, click "Join Cluster" paste the information, input the cluster's password, and click join. Wait for a few seconds until the join is successful. From now on, you only use the cluster's web UI.
Check out the official quick start guide.
Creating a Virtual Machine in Proxmox
Now that our new machine is part of the cluster, it's time to create a virtual machine (VM) that will serve as our new Kubernetes worker node. I'll use Ubuntu Server as the base operating system for this VM, as it provides a solid foundation for running Kubernetes. In Proxmox, creating the VM is as simple as giving it a name, allocating resources such as storage, CPU cores, and RAM, and then booting it up.
Installing Kubernetes with K3S
Once the VM is up and running with Ubuntu Server, we're ready to install Kubernetes. To keep things lightweight and beginner-friendly, we'll use K3S, a minimalistic version of Kubernetes developed by the Rancher team. By following a quick start guide, setting up K3S on our Ubuntu server becomes a breeze. We'll ensure that the environment variables "K3S_URL" and "K3S_TOKEN" are set correctly to enable the worker node to join the existing cluster.
However, if this is the first node (the control plane) of this Kubernetes cluster, you don't need to set those variables, instead just run the installation command.
This takes care of everything, including ensuring that k3s starts upon rebooting the VM.
Check out the official K3s quick start guide.
Expanding Your Possibilities with Kubernetes
With our new node successfully integrated into the Kubernetes cluster, the possibilities are endless. From hosting websites to running various applications and databases, you can easily leverage the power of Kubernetes for your projects. In the near future, stay tuned as we tackle exciting projects such as building a portfolio website from scratch, covering everything from design and front-end development to back-end development, deployment to Kubernetes, and hosting online.
Monitoring Power Consumption with Smart Plug
To keep track of the power consumption of our server, I'll include a smart plug in my setup. This handy device allows us to accurately measure the power consumed by the mini PC. Monitoring power consumption not only helps us optimize efficiency but also sheds light on the cost-effectiveness of having our own Kubernetes cluster compared to utilizing cloud services.
In this case I am running 3 Mini PCs totaling 24 threads, 48 GB of RAM and NVME storage, all under 50W.
Conclusion
In this blog post, I demonstrated how to add a new node to your Kubernetes cluster in under 5 minutes using a compact mini PC. By following the step-by-step guide, you can expand the capabilities of your cluster and gain valuable insights into cloud computing. From cost-effectiveness to versatility, building and managing your own Kubernetes cluster opens up a world of possibilities for hosting various applications and accelerating your learning journey. Stay tuned for more exciting projects and developments on our channel!
Thank you for reading and following. I am looking forward to sharing more insightful content with you in the future.
Consider Subscribing to my YouTube channel:
Posted on January 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.