Contoh, untuk mengupgrade ke current stable release:
curl -sfL https://get.k3s.io | <EXISTING_K3S_ENV> sh -s - <EXISTING_K3S_ARGS>
Jika ingin mengupgrade ke versi terbaru dari channel yang spesifik (misal latest) maka dapat di baut spefisik untuk nama channel nya:
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=latest <EXISTING_K3S_ENV> sh -s - <EXISTING_K3S_ARGS>
Jika ingin mengupgrade ke versi yang spedifik, bisa menjalankan perintah berikut :
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=vX.Y.Z+k3s1 <EXISTING_K3S_ENV> sh -s - <EXISTING_K3S_ARGS>
jika ingin mengupgrade namun tanpa menjalankannya secara otomatis untuk k3s, maka bisa menambahkan argument INSTALL_K3S_SKIP_START=true
.
Contoh hasil output :
Versi node sebelum upgrade
root@uworkshop-GK35:~# kubectl get nodes NAME STATUS ROLES AGE VERSION svr-nuc6cayh Ready control-plane,etcd,master 58d v1.29.8+k3s1 svr-nuc6cayh2 Ready control-plane,etcd,master 42d v1.29.8+k3s1 uworkshop-gk35 Ready control-plane,etcd,master 71d v1.29.8+k3s1 root@uworkshop-GK35:~#
Contoh pada node master 01 :
root@uworkshop-GK35:~# curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.30.6+k3s1 sh -s - server --cluster-init [INFO] Using v1.30.6+k3s1 as release [INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/sha256sum-amd64.txt [INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/k3s [INFO] Verifying binary download [INFO] Installing k3s to /usr/local/bin/k3s [INFO] Skipping installation of SELinux RPM [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@uworkshop-GK35:~#
Contoh pada node master 02 :
root@svr-NUC6CAYH:~# curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.30.6+k3s1 K3S_TOKEN=IdTokenK3nyaBerapasx K3S_URL=https://uworkshop-gk35:6443 sh -s - server [INFO] Using v1.30.6+k3s1 as release [INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/sha256sum-amd64.txt [INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/k3s [INFO] Verifying binary download [INFO] Installing k3s to /usr/local/bin/k3s [INFO] Skipping installation of SELinux RPM [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@svr-NUC6CAYH:~#
Contoh pada node master 03 :
root@svr-NUC6CAYH2:~# curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.30.6+k3s1 K3S_TOKEN=IdTokenK3nyaBerapasx K3S_URL=https://svr-nuc6cayh:6443 sh -s - server [INFO] Using v1.30.6+k3s1 as release [INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/sha256sum-amd64.txt [INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/k3s [INFO] Verifying binary download [INFO] Installing k3s to /usr/local/bin/k3s [INFO] Skipping installation of SELinux RPM [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@svr-NUC6CAYH2:~#
Check versi setelah upgrade
root@uworkshop-GK35:~# kubectl get nodes NAME STATUS ROLES AGE VERSION svr-nuc6cayh Ready control-plane,etcd,master 58d v1.29.8+k3s1 svr-nuc6cayh2 Ready control-plane,etcd,master 42d v1.29.8+k3s1 uworkshop-gk35 Ready control-plane,etcd,master 71d v1.30.6+k3s1 root@uworkshop-GK35:~#
Tinggal jalankan satu – satu