K3s upgrade to 1.31.5 (Day 22)

K3s upgrades are surprisingly simple - just rerun your initial install command and you're done

K3s upgrade to 1.31.5 (Day 22)
Photo by Stefan Steinbauer / Unsplash

Upgrading K3s is remarkably straightforward. You just use the same install command you used when first creating your cluster for me that's:

NB: This is a single node k3s cluster
curl -sfL https://get.k3s.io | sudo INSTALL_K3S_EXEC='--disable=traefik,disable-kube-proxy,disable-network-policy --flannel-backend=none --write-kubeconfig-mode=644 --etcd-expose-metrics true' sh -

About Those Flags

Looking at the install command, you might notice several flags:

  • --disable=traefik: Disabled because I'm running my own managed version of Traefik
  • --disable-kube-proxy,--flannel-backend=none: Both disabled as Cilium handles these functions (CNI and service networking)
  • --write-kubeconfig-mode=644: Sets readable permissions on the kubeconfig file right from the start
  • --etcd-expose-metrics true: Exposes etcd metrics.

In my case, the output showed:

[INFO]  Finding release for channel stable
[INFO]  Using v1.31.5+k3s1 as release
[INFO]  Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.31.5+k3s1/sha256sum-amd64.txt
[INFO]  Skipping binary downloaded, installed k3s matches hash
[INFO]  Skipping installation of SELinux RPM
...
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
...

Verifying the Upgrade

After the upgrade, your workloads should continue running without interruption. You can verify the new version with:

k3s -version

That's really all there is to it - K3s keeps things refreshingly simple.