Requirements: - User with access to sudo - Only Debian based devices - Use vars to target specific kubeadm/let/ctl version - DNS name must match the name of the node when using `kubectl get nodes` command - Host/Client that will execute this script requires to have `kubectl` configured to use the targeted kubernetes cluster. - https://docs.ansible.com/ansible/latest/collections/kubernetes/core/docsite/kubernetes_scenarios/k8s_intro.html | ansible-galaxy collection install kubernetes.core [0] ``` [0] pacman -S python-kubernetes https://stackoverflow.com/questions/60866755/ansible-k8s-module-failed-to-import-the-required-python-library-openshift-on ``` Order: - Update repositories [-3] - Check available versions to upgrade to and update the config accordingly [-2] - Check if applied CRD work on the desired Kubernetes version [-1] - Backup (if available, as per the moment manual since it's not a main concern) [0] - Upgrade Kubeadm [1] - Call upgrade [2] - Drain node [3] - Update kubelet/kubectl versions [4] - Reboot services [5] - Upgrade system cause one needs it from time to type [6] - Uncordon node [7] ----- Done with all hosts - Upgrade CRD (this will not be covered on this script, so you do you) ``` [-3] https://kubernetes.io/blog/2023/08/15/pkgs-k8s-io-introduction/ [-2] apt update apt-cache madison kubeadm | head -n 5 [-1] (This is mine. comparing to kubernetes 1.28.5) - [x] Calico v3.26.3 (v3.26.4 available) - [x] Istio 1.18.2 (v1.20 available) - [?] MetalLb v0.13.10 (v0.13.12 available) *Didn't find anything regarding the matter, so going to assume yes and see what happens. - [x] CertManager v1.13.1 (v1.13.3 available) [0] Proxmox stuff/VMs [1] apt-mark unhold kubeadm && \ apt-get update && apt-get install -y kubeadm='1.28.x-*' && \ apt-mark hold kubeadm [2] sudo kubeadm upgrade node [3] kubectl drain $NODE [4] apt-mark unhold kubelet kubectl && \ apt-get update && apt-get install -y kubelet='1.28.x-*' kubectl='1.28.x-*' && \ apt-mark hold kubelet kubectl [5] sudo systemctl daemon-reload sudo systemctl restart kubelet [6] usual apt-get update > upgrade > reboot [7] kubectl uncordon ```