Upgrade the K3s Appliance
An upgrade moves the machine to a newer release from that release's tarball. The installer keeps your generated credentials, so existing database and login data survive.
Upgrade a single machine
- Get the new tarball with its
.sha256(and its.sig, when published), verify it and extract it into a new, empty directory. - From the new directory, run:
sudo ./install.sh upgrade
The upgrade starts from the settings the last install saved in /etc/odin/install.env. Give a flag to change one, for example to renew a certificate:
sudo ./install.sh upgrade --tls-cert /etc/ssl/odin-new.crt --tls-key /etc/ssl/odin-new.key
With the bundled MinIO, a domain and a certificate, the application reaches its own storage through Traefik and trusts the certificate you gave, so renewing it is a run of the installer with the new files, as above, and not a replacement of the files in place: the run rebuilds the trust bundle and restarts the application when the bundle changed (a renewal under the same CA leaves it as it was, so nothing restarts). Do it before the old certificate expires. For a private CA the new file should end with the CA's root certificate (Install).
What the upgrade does
In order. Steps 1 to 3 only check, so nothing on the machine has changed when the backup in step 4 starts:
- Refuses what k3s cannot do in place: skipping a Kubernetes minor version, or going back one.
- Refuses to go back to an older release, unless you pass
--force. - Runs the same host checks as an install, and the bundle integrity check.
- Takes a backup to your backup destination (for an
s3://one it uses the region you gave with--backup-s3-region). k3s stops for a few seconds while the datastore is copied. An install that has no destination is a special case. - Lays the new bundle down and restarts k3s on the new binary.
- Waits up to 30 minutes for the chart's rollout to finish (
sudo ODIN_UPGRADE_TIMEOUT_SECONDS=3600 ./install.sh upgradewaits longer).
Expect EKB to be unavailable while k3s restarts and the chart rolls out. A single machine has no rolling upgrade. Schedule the upgrade for a quiet period.
Never skip a Kubernetes minor version between releases: k3s, like Kubernetes, supports upgrading one minor version at a time. If the new bundle is more than one minor ahead, upgrade through the releases in between.
Without a backup destination
An install made with --no-offbox-backup has nowhere to put the backup of step 4, so a bare upgrade stops at its checks, before anything on the machine changes. Either give a destination, which the scheduled backups then use too:
sudo ./install.sh upgrade --backup-dest /mnt/odin-backups
or back up another way first (sudo ./backup.sh --dest <directory>) and say that you accept an upgrade that takes no backup:
sudo ./install.sh upgrade --yes
--yes is about one run and is not saved with the other settings, so give it on every such upgrade.
An install made before the settings file existed has no saved backup choice at all, so its first upgrade needs --backup-dest, or --no-offbox-backup together with --yes.
If the upgrade fails
- The chart's upgrade failed. k3s is set to leave the release as it is for an operator instead of reinstalling it, which could lose data. Read the reason with the chart job's log, then contact support:
k3s kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml -n kube-system logs job/helm-install-odin-services
- It timed out. The new bundle is already in place and the chart's upgrade may only be slow. Follow it with
logs -fon the same job, checksudo ./install.sh status, and runupgradeagain from the same bundle, which is safe. - The backup before the upgrade failed. Nothing was upgraded. Fix what
backup.shreports and runupgradeagain.
There is no rollback command. To go back, run upgrade --force from the older release's tarball when it needs the same Kubernetes minor, or rebuild the machine on the older release from the backup the upgrade took first, as in Recovering from the loss of the machine. Neither has been drilled end to end yet.
Upgrading a cluster
A cluster is upgraded from one server, with upgrade --ha, from the new release's extracted tarball; a plain install.sh or upgrade from another bundle is refused on a cluster node.
sudo ./install.sh upgrade --ha
It checks the whole cluster first (every node Ready, etcd healthy, the database and its pooler ready, the new k3s version one the nodes can step to), takes a backup, stages the new bundle on this server, then lets the cluster's system-upgrade-controller upgrade the servers one at a time (so the database keeps a majority) and then the workers, respecting the disruption budgets. Finally it re-applies the charts and records the new release. It needs the cluster's API, so run it on a server whose k3s is running.
--manualis the fallback if the nodes cannot pull the upgrade image from each other:sudo ./install.sh upgrade --ha --manualon every node in turn, workers too, stages the bundle on that node and stops, taking no backup and changing nothing in the cluster; thenupgrade --haonce, on one server.- If a node's upgrade fails, the cluster is not left half-applied: the command stops with what to look at, and
upgrade --harun again continues. Until it has finished, a plaininstall.shis refused on every node. - Only the server the command ran on gets the new bundle's configuration. The others show configuration drift in
statusuntilsudo ./install.shis run on each from the new bundle, one at a time.