Upgrading to K3s

Upgrading to k3s on my Raspberry Pi 4 Cluster

kubernetes plus raspberrypi

Time to upgrade the software with my cluster. Just like any other upgrades I do this is small in incremental. My last post I did an upgrade to the hardware. This time I am upgrading the software. Now to be fair this isn’t the app I currently have running on my cluster. But to update the Kubernetes running my cluster.

First the operating system. I am sticking with Ubuntu 20.04.1 LTS. First it’s LTS, I hate upgrading OS’s. Next it’s known to me. I have been using it for years now. I am very familiar with this flavor of Linux. I did consider moving to Ubuntu Core for this project. But Core is a slimmer version than server. I don’t know what I am missing and what I am going to need to fill in.

Networking was also a known for me. Netplan is yaml based and arguably easy to work with. Less for me to worry about. So for these we are going with what I know and what is working great.

Not to say Microk8s wasn’t working well. It was, it did a great job. It was easy to enable things I needed like Helm and what not. But now I want to give k3s a solid go. I have read a few good post about why it’s better for edge. And if we look at why? The reasons to use k3s well, the smaller profile is nice, they have it down to a single binary. Next they have optimize this installation for ARM. Lot of promise here but let’s see how this compares to what we are giving up. Microk8s comes with a lot of features we can enable.

This gives us two ways to think of these distributions. And I am going to go all .NET with everyone here to do it. Microk8s is our classic .NET Framework, think 4.6. It had everything and the kitchen sink. Where as k3s are .NET Core you get the base but you have to add in what you want. Neither one of these models are bad. But if we are going to try to slim down our instances and footprint we are going to want to try something new.

Now where I could see an issue is with my OS. k3s are supported on 18.04 and 16.04 Ubuntu. I don’t think this is going to be an issue but we will see.

Getting Started

I have my four Raspberry Pi’s up and running. With up-to-date operating systems. From the documentation with k3s installation looks pretty straight forward.

But before we can do this we are going to need to set Netplan to have the same static IP address as what I set with UDM.

network:
    ethernets:
        eth0:
            addresses: [192.168.1.X/24] # note "X" is what ever you set your ip address to.
            gateway4: 192.168.1.1
            nameservers:
              addresses: [8.8.8.8,8.8.4.4]
            dhcp4: no
    version: 2

So on my server Pi we are going to run the quick start shell script.

curl -sfL https://get.k3s.io | sh -

One thing to note the naming convention is different. We don’t use the term master it is server. The workers are now agents. All for the change in terminology and just wanted to call it out.

And just like that k3s are up and running. Now this is just the server we are going to need to set up all of our agents next. The command below is how we can quickly set up our agents.

curl -sfL https://get.k3s.io | K3S_URL=https://192.168.1.X:6443 K3S_TOKEN=<specific k3s token> sh -

After running this command on the three other Raspberry Pi’s that’s it. Done. This setup and install was fast and easy. Almost too easy. There are a few commands I miss about Microk8s. But I have to give credit where credit is due Rancher did a great job with this flavor of Kubernetes.