Upgrading/Downgrading K3S
January 15, 2023 | ClusterCurrently I had a problem with Longhorn not compatible with k3s version v1.25.4+k3s1. So, after a lot of debugging I came to the conclusion that I had to do a downgrade of the cluster. I guess almost the same procedure would apply for an upgrade.
Downgrade
As you probably have some more fine grained configuration on the cluster, that you want to preserve. It is important that you somehow get these carried over.
I'm keeping my configuration for each node in: /etc/rancher/k3s/config.yaml
So, I don't have to recall all the flags nessesary to deploy to my needs/setup.
Process
Take one node at the time.
Drain the node
kubectl cordon [node]
kubectl drain [node]
it might be nessesary to use the --ignore-daemonsets flag, you will get a reminder if that is the case
Then SSH to the node that you want to update/downgrade (this step may be skipped)
sudo systemctl stop k3s.service
(you may also stop other relevant k3s services as k3s-agent.service)
I want to downgrade to v1.24.7+k3s1 so I'll just export that:
export INSTALL_K3S_VERSION=v1.24.7+k3s1
and then install this version:
sudo curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=$INSTALL_K3S_VERSION sh -
after that you should be able to start k3s again: (if you did'nt stop the agent, this step may not be nessesary)
sudo k3s
and on agents nodes:
sudo k3s agent
You might try to reboot the node if you get some errors in this process..
Remember to uncordon the node again:
kubectl uncordon [node]