HomeLab - Part 1
Okay, we got this assignment from work so we can improve our general skills about the recent technologies and also to get familiarized with build our own Lab.
The main technologies to explore would be:
- Containerization
- DNS (on a domain level)
- DDNS
- Tunnels
- Proxy/Reverse Proxy
- Port Forwarding
Considering that not every person in the team would have worked with those, getting some level of knowledge would be incredibly awesome and to get us working together as team, fortifying friendship and valuable common interests among all.
Nevertheless, we would also acquire more knowledge of networking, OS imaging/install, web servers, and all the involved to get a "server" on the internet.
Since the assignment is explained, let's deep dive into my approach to it.
- Kubernetes Cluster
- Cloudflare Tunnel
- Wiki portal
Sounds easy right?! Let me tell you right away, nope!, not at all.
Hardware:
- 3x Raspberry Pi 4B with 8GB of RAM
- 2x USB drive of 32GB
- 3x SD Card 32GB
- Cisco Switch Catalyst 3560-CX with 8 PoE ports up to a max of 240W
- Few bits and pieces, like Ethernet cables, RS232 USB adapter for the Cisco and so on...
So it begins, I've imaged the cards with the firmware update tool to make sure it was booting from the SD card and in case there was none to failsafe to the USB stick, also making sure it was running the latest version. Imaged afterward with Ubuntu Server Headless (no GUI) on all 3 SD Cards. Pretty straight forward here.
The Raspberry Pi Imager is pretty easy to use and makes it really handy.
Moving on, connected the Cisco Switch to the home network through a large cable I had already connected to my desktop computer and connected every cable to both PC and the 3 Raspberry's. Andddddd it started bad right away, one of the Raspberry's was dead, wouldn't boot on anything and made the PoE HAT make noise. That one was set aside and got myself an HP Thin Client T730 which was set aside, especially because that would require an extensive setup and I would like to start working right away, so decided to move with only 2 Raspberry's.
As I had 2 USB sticks, I decided before moving forward to make some IO speed tests and at the same time, internet connection to all over the world. This script is pretty well known as YABS (Yet Another Benchmark Script) and worked perfectly well for our purpose, marking that using USB Sticks was way faster (in fact 2x faster) than using the SD Cards and with that decided to ditch them completely from this build.
Since we were running bare Ubuntu Server images, after some research I've decided to go with MicroK8S as it setups a low operations Kubernetes environment. +Info
Straight forward and no errors process. Went ahead and installed the addon Portainer, which is, again, just a command away of being setup automatically.
Requested the 3 Node Business Edition and set it up.
We don't need to setup Portainer on more than a node, as it would manage the cluster directly.
With Portainer installed and upgraded, I've started to setup the cluster within Portainer.
I've run into some issues related to sudo as for some reason after logging in to the 2nd cluster, Portainer ran sudo only one time with the provided password which ended in the second time sudo was run it would ask password and fail the cluster creation. +Info
A few minutes in with troubleshooting and applying the correct fix, and I've ended up with this lovely image:
Okay, we have a cluster, now should be a matter of creating apps, and it would balance them, good. In fact, the app creation and auto distribution of the apps was working fine, and I started the setup of Cloudflare Tunnel. It's a straight forward setup, I setup the NS for the domain, created the tunnel and was given with a command to run either directly through the OS or inside Docker. Tried to map Portainer to the external world, no go, tried a lot of things and ended up breaking all the setup I've done before. Had to start from scratch.
After a few hours in with the new setup I'm still running into the same issue and after a huge amount of tries it got me nowhere in terms of getting the traffic routing through the Cloudflare tunnel and being shown to the internet. As I was running out of time to get all finished, I've decided to make it a little bit easier on me this first time and went with creating a setup that works, so I don't get fired (kidding) and obviously present some work and ideas to the colleagues/management.
To be continued...