system-upgrade
This hosts system upgrade automation.
Prepare the nodes¶
- Label masters for k3s server upgrades:
kubectl label nodes <MASTER_NODE> plan.upgrade.cattle.io/k3s-server=enabled
- Label workers for k3s agent upgrades:
kubectl label nodes <WORKER_NODE> plan.upgrade.cattle.io/k3s-agent=enabled
- Label archlinux nodes (currently all of them):
kubectl label nodes <NODE> plan.upgrade.cattle.io/archlinux=enabled
- You need to do that only once in node's lifetime
Upgrade k3s¶
- Email is sent for releases watch on https://github.com/k3s-io/k3s
- Update version in
system-upgrade/system-upgrade-controller/plans/k3s.yaml
- Apply the plan:
kubectl apply -f system-upgrade/system-upgrade-controller/plans/k3s.yaml
Upgrade system¶
- Update version in
system-upgrade/system-upgrade-controller/plans/archlinux.yaml
to today's date in yyyymmdd format - Apply the plan:
kubectl apply -f system-upgrade/system-upgrade-controller/plans/archlinux.yaml
Get email with upgrade eligibility¶
- SSH to any node
- Install prerequisites:
sudo pacman -S cronie s-nail
- Enable scheduling:
sudo systemctl enable --now cronie
- Configure email:
sudo vim /etc/mail.rc
set v15-compat set from="B.U.V.I.S <postman@iron.buvis.net>" set mta=smtp://<user>:<password>@email-smtp.eu-west-1.amazonaws.com:587 \ smtp-use-starttls
- Create checker script:
sudo vim /usr/local/bin/check-upgrade.sh
fromsystem-upgrade/system-upgrade-controller/check-upgrade.sh
- Make it executable:
sudo chmod +x /usr/local/bin/check-upgrade.sh
- Schedule it:
sudo crontab -e
:# minute hour day_of_month month day_of_week command # | | | | | | 0 18 * * * /usr/local/bin/check-upgrade.sh
Troubleshooting¶
- observe the upgrade:
kubectl get all -n system-upgrade
- it seems deleting the jobs that are stuck is tolerated by the controller, but being patient (default poll interval is 15 minutes) is preferred