Assembling a homelab using Talos Linux: Part I
Yes, another on-premises cluster, what’s new?
There comes a time in a technology enthusiast’s life when they decide to build a homelab. Chances are if you’re reading this, you’ve either googled the term and know what I’m talking about — so I promise not to take long in this introduction — or you’re following me (stalking much?) and don’t necessarily care.
In any case, I’ve long had VPSes to host my personal projects and services like Plex for myself and close friends. It’s always seemed much cheaper than purchasing the equipment and hosting on-premises. Recently I’ve even set up a Kubernetes cluster using k0s, a Kubernetes distribution made to be simple and lightweight. Latency, bandwidth limits and weak hardware have compelled me to build one instead.
Hardware
I don’t have the space for a server rack, nor the time to shop for enterprise equipment bargains on Facebook Marketplace and similar platforms. Much less the patience to deal with the noise and heat of server equipment. So since I recently upgraded my desktop from an Optiplex 3080 Micro to a custom build, I decided to repurpose it as my starting point.
The next step was to bargain hunt for small form factor PCs that could be used to compose the cluster. I found a few Lenovo Tiny M920q PCs on Facebook Marketplace for a good price, as well as an Optiplex 7070 Micro on sale by another seller. I bought 3 of the Lenovo PCs, and that Optiplex, to have a total of 5 nodes.
I bought a bigger shoe rack off Amazon and used the old one as a shelf for these machines. Now I have something of a homelab corner:
It looks messy, I know, but I did my best. The lower shelf will hopefully be populated by a NAS sometime in the next year. You might have noticed the Lenovo computers each came with a DVD drive. Isn’t that refreshing?!
You might also notice there’s a network switch above one of the Optiplex computers in the picture above. That’s a cheap NETGEAR GS108 switch I bought off Amazon, alongside a 5-pack of CAT6 cables. I have no need for more than a Gigabit, and these machines don’t have 2.5GbE or 10GbE ports anyway, before you ask. I had to buy a very long Ethernet cable to connect to the ISP’s router, too. I hope to get a better router in the future.
I have to say, hoooking up all these machines to the switch felt very satisfying. Maybe it’s the clicky sound of the RJ45 connectors, or the fact that with every click another machine was added to the network. I don’t know, but it at least doesn’t look too messy:
Lucky for me these guys, with one exception, all have the same CPU, an i5-8500T, and 16 GB of RAM. The exception is my old Optiplex 3080, which has a more powerful i5-10500T and 64 GB of RAM. I’ll be using that one as the sole control plane node, and hope that in the future I can find more of the same model for cheap to make the control plane highly available.
Software
At first I thought I was going to reproduce the k0s installation I’ve got on my VPSes, and found that unfortunate. Going through the hassle of installing something like Debian with an SSH daemon, then use roughly the same Ansible playbooks? I’d learn nothing new! At first I thought it was a good opportunity to use NixOS, but then I stumbled upon Talos Linux, a Linux distribution built for Kubernetes that is production ready.
Talos is one of those immutable distributions, and its machine configuration
is declarative, much like any other Kubernetes resource. It’s got a
convergence mechanism in talosctl
, and is mature enough that it is used in
production already. So I went ahead and set it up! This is what the Talos
dashboard looks like for the machine in the control plane currently:
In the next part of this series of blogposts, I’ll go through the process of configuring the machines and setting up the cluster. If you want to go through the files I’m using, you can look at this repository on GitHub.