I am currently studying to complete my CKA and wanted to deploy Kubernetes at home. Although there are other popular Kubernetes deployments for home such as minikube, K3s, or even MicroK8s, I wanted to deploy the “full” deployment. Naturally I ran into a number of issues and it ended up being a big hassle.
Now though, after having deployed it several several several times, I have a straightforward process which will hopefully make it easier for others.
Before diving too far into the weeds, I want to call out a few sites I used heavily to help me build my Kubenetes cluster.
Install Kubernetes Cluster on Ubuntu 22.04 with kubeadm
How to Install Kubernetes Cluster on Ubuntu 22.04
If for some reason my walk-through doesn’t give you all the answers you need, hopefully one of those links will help you.
Imaging the SD Card
As most deployments with RPis, this one starts with Imaging. I am using the latest Raspberry Pi Imager which happens to be 1.7.3 and the latest 64bit Ubuntu Server LTS build.
Before this process, it had been a while since I had used the RPi Imager and I found this new-ish Gear feature really helpful.
If you don’t see the gear on your Imager, you should be able to hit Ctrl+Shft+X to make it appear. In here we have a number of option to name the RPi, create a user, and Setup Wifi.
This ended up being incredibly helpful for me as I ran into multiple problems and re-imaged my RPi frequently to start from the beginning. Configuring the top-most setting as “To Always Use” allowed my settings to persist between images.
Here is a look at how I configured mine.
Next I was able to image my SD card:
Initial Ubuntu Config
After the SD card is imaged, placed into the RPi and powered on. I ssh into the device.
Naturally the first thing we are going to do is to update and upgrade Ubuntu
sudo apt update
sudo apt upgrade
This will take a bit of time to complete as it updates all the apps.
Statically Configure IP
Although I have the reservation configured in DHCP for the RPi, I do also like setting the IP manually on the device just in case.
For the configuration we are going to utilize netplan. This procedure is also outlined in the first reference link above.
First we need to create a config file to disable the cloud config. This file can be name just about anything, however it does need to start with “99” as the files in this directly are read in order and we want this to be the last file read.
sudo nano /etc/cloud/cloud.cfg.d/99-disable-cloud.cfg
The file should have one line
network: {config: disabled}
After entering the line, exit and save the file.
Now we need to create a new config with our static configuration.
sudo nano /etc/netplan/01-static.yml
This is my example configuration:
network:
version: 2
wifis:
renderer: networkd
wlan0:
access-points:
NetworkName:
password: 7ab7819e586da42cbe4a369a8cf015c4bb280657ccfa50da
dhcp4: false
optional: true
addresses: [192.168.2.101/24]
gateway4: 192.168.2.1
nameservers:
addresses: [192.168.2.160]
Save and exit the file.
Now we want to delete the contents of 50-cloud-init.yaml
sudo nano /etc/netplan/50-cloud-init.yaml
Delete everything not commented out and save/exit
Next all we need to do is apply the changes:
sudo netplan apply
I had issues with DNS using the correct servers, but was eventually able to resolve the issue from this link.
sudo unlink /etc/resolv.conf
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved.service
Basically the resolved service was using a symlink and information we didn’t want.
So prior to the change:
And after:
In my next post we are going to finish installing the required apps, and continue with initial Kubenetes install and configuration!