k3s Kubernetes lab on a Pi cluster – excellent!

Hardware used:

I am using (4) Raspberry Pi Model 4b (8 gig models) with PoE hats and a Netgear 5-port switch with (4) PoE ports which can be found here. This set up is popular and I think made (famous?!) by Jeff Geerling. I used his Wiki to come up with a game plan and highly recommend anyone that wants to procure the parts needed to build the cluster do the same. You can access his Wiki here, which actually runs on his Pi Dramble cluster in his basement. Super cool! I’m not going to deploy Dramble to my cluster. Actually, I don’t know what I’m going to deploy to the cluster yet 🙂

I’ve chosen the k3s distribution by Rancher as it a perfect fit for my purposes. Initially, I’m deploying to the cluster using this Ansible playbook by Github user itwars.

Hardware checklist:

Prep work:

  • Image your SD cards with Raspbian Lite and create an empty file named ‘ssh’ on the root of the file system. You can do this by simply running ‘touch ssh’ from the command line.
  • Install the PoE hats
  • Rack each Pi in to the Bone Plate.
  • Insert the imaged SD cards in to each Pi.
  • Using the Ethernet port on the Pi, plug each Pi in to a PoE port of your Netgear switch.
  • Plug the Netgear switch in to your network.
  • Identify the MAC address of each Pi (I used my Ubiquiti controller interface)
  • Reserve a unique static IP for each MAC to be assigned via DHCP
  • Create a password-less ssh key pair to automate the Ansible deployment
  • Copy the public key part of that pair to each pi in the ~/.ssh/authorized_keys (I just used the ‘pi’ user).

With the prep work out of the way, you can now run the Ansible needed to set up the cluster. I made two simple changes: 1) Update hosts.ini to correctly reflect my inventory (IP addresses assigned to the Pi devices) and 2) Change group_vars so that the playbook uses the appropriate username to connect to the pi. Otherwise, I followed the instructions exactly as they are in the Readme, executed the playbook, and have a fully-functioning cluster:

Leave a comment

Close Bitnami banner