====== Update vom K3s Cluster ======
Ein Upgrade ist im Grunde ganz einfach. \\
Es gibt verschiedene Möglichkeiten
* Via Installations Script
* Voll Automatisch via - system-upgrade-controller
* Manuell
\\
Aktuell gehe ich nur die Version via Installations Script und Manuell ein. \\
Mir persönlich ist die manuelle Version lieber. Daher auch hier als erstes angeführt.
\\
===== Manuelles Upgrade =====
Hier benötigt man keine Infos über die Parameter bei der Installation oder sonst etwas. \\
==== Download der neuen Version suchen ====
[[https://github.com/k3s-io/k3s/releases|https://github.com/k3s-io/k3s/releases]]
\\
==== Backup der atkuellen Version ====
cp -a /usr/local/bin/k3s /usr/local/bin/k3s_v1.19.5
\\
==== Stoppen einer Node ====
systemctl stop k3s*
/usr/local/bin/k3s-killall.sh
systemctl status k3s*
\\
==== Update einer Node ====
cd /usr/local/bin/
wget -O k3s https://github.com/k3s-io/k3s/releases/download/v1.20.0%2Bk3s2/k3s
\\
==== Starten einer Master Node ====
systemctl start k3s.service
systemctl status k3s.service
\\
==== Starten einer Worker Node ====
systemctl start k3s-agent.service
systemctl status k3s-agent.service
\\
----
===== Via Installations Script =====
Es ist wichtig das man die Parameter vom installieren noch weiß da man diese hier wieder anwenden muss! \\
Die Parameter vom Update werden wieder in den Scripten zum Starten von K3s übernommen.
\\
Das Upgrade funktioniert genau wie eine Installation auch.
Beispiel:
curl -sfL https://get.k3s.io | sh -
Hier sollten aber wie gesagt die Parameter von jeder Node bei der Installation berücksichtigt werden.
\\
\\
==== Upgrade K3s Using the Installations Script - Master Node ====
root@kube01:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube01 Ready master 13d v1.19.4+k3s1
kube02 Ready 13d v1.19.4+k3s1
kube03 Ready 13d v1.19.4+k3s1
export INSTALL_K3S_EXEC="--disable servicelb --disable traefik"
curl -sfL https://get.k3s.io | sh -
[INFO] Finding release for channel stable
[INFO] Using v1.19.5+k3s2 as release
[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping /usr/local/bin/kubectl symlink to k3s, already exists
[INFO] Skipping /usr/local/bin/crictl symlink to k3s, already exists
[INFO] Skipping /usr/local/bin/ctr symlink to k3s, already exists
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[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.
[INFO] systemd: Starting k3s
root@kube01:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube01 Ready master 13d v1.19.5+k3s2
kube02 Ready 13d v1.19.4+k3s1
kube03 Ready 13d v1.19.4+k3s1
\\
==== Upgrade K3s Using the Installations Script - Slave Node ====
curl -sfL https://get.k3s.io | sh -