I just noticed that I’m still running the same k3s version that I originally installed, 1.20.5+k3s1
. It is not supported anymore, so I decided to upgrade it to the most recent 1.23.4+k3s1
.
The first step was to plan the upgrade as carefully as possible to avoid any nasty surprises. Since the upgrades must be done one major version at a time (1.20.x -> 1.21.y
), I went first to the k3s releases page to see, what my upgrade path would look like. I also took a look at the k3s version-specific caveats page to see, if there were any issues affecting my environment (nope, there weren’t any.)
I upgraded all the nodes from one version to another following this process:
- Take the first node and drain it:
kubectl drain master01 --ignore-daemonsets --pod-selector='app!=csi-attacher,app!=csi-provisioner'
- If you get the following error:
error: unable to drain node "master01" due to error:cannot delete Pods with local storage (use --delete-emptydir-data to override): kube-system/metrics-server-86cbb8457f-qnbl2, continuing command...
- Run:
kubectl drain master01 --ignore-daemonsets --delete-emptydir-data --pod-selector='app!=csi-attacher,app!=csi-provisioner'
- If you get the following error:
- Stop
k3s
systemd service:systemctl stop k3s.service
- Replace the binary
/usr/local/bin/k3s
with version1.21.10+k3s1
and make sure the owner and file permissions are correct after copying. - Start
k3s
systemd service:systemctl start k3s.service
- Uncordon the node:
kubectl uncordon master01
- Wait until Longhorn has got the volumes to healthy state.
- Rinse and repeat for the other two nodes.
- Rinse and repeat the whole process for the newer versions.