diff --git a/Cluster_admin/nodes_update_commands.md b/Cluster_admin/nodes_update_commands.md new file mode 100644 index 0000000..e450a8f --- /dev/null +++ b/Cluster_admin/nodes_update_commands.md @@ -0,0 +1,113 @@ +# OS package update runbook for Hetzner cluster nodes + +Order: **master first, then workers, ONE NODE AT A TIME.** +Verify each node is `Ready` before uncordoning and before moving to the next. + +Replace `` with: `master-4gb-hel1-2` | `ubuntu-4gb-hel1-docker` | `woker-1-8gb-hel1-1` + +## Per-node sequence + +1. From your admin machine: cordon + drain the node so workloads migrate + + ```bash + kubectl drain --ignore-daemonsets --delete-emptydir-data + ``` + +2. Confirm drain finished (pods gone, node marked `SchedulingDisabled`) + + ```bash + kubectl get nodes + kubectl get pods -A --field-selector spec.nodeName= --watch + ``` + +3. SSH into the node + + ```bash + ssh + ``` + +4. Inside the node: update OS packages + + ```bash + sudo apt update && sudo apt upgrade -y + sudo apt autoremove -y + ``` + +5. (Optional) check what needs a reboot; usually kernel/glibc upgrades do + + ```bash + cat /var/run/reboot-required 2>/dev/null || echo "no reboot required" + ``` + +6. Reboot the node to apply kernel updates + + ```bash + sudo reboot + ``` + +7. Wait for the node to come back, then from your admin machine verify it's `Ready` + + ```bash + kubectl get nodes -w + # Wait for: Ready + ``` + +8. Uncordon the node so it accepts pods again + + ```bash + kubectl uncordon + ``` + +9. Verify workloads re-scheduled and healthy + + ```bash + kubectl get pods -A --field-selector spec.nodeName= + kubectl get nodes + ``` + +## Full sequence + +### master-4gb-hel1-2 + +```bash +kubectl drain master-4gb-hel1-2 --ignore-daemonsets --delete-emptydir-data +# ssh master-4gb-hel1-2 -> sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y +# sudo reboot +# (wait for Ready) +kubectl uncordon master-4gb-hel1-2 +``` + +### ubuntu-4gb-hel1-docker + +```bash +kubectl drain ubuntu-4gb-hel1-docker --ignore-daemonsets --delete-emptydir-data +# ssh ubuntu-4gb-hel1-docker -> sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y +# sudo reboot +# (wait for Ready) +kubectl uncordon ubuntu-4gb-hel1-docker +``` + +### woker-1-8gb-hel1-1 + +```bash +kubectl drain woker-1-8gb-hel1-1 --ignore-daemonsets --delete-emptydir-data +# ssh woker-1-8gb-hel1-1 -> sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y +# sudo reboot +# (wait for Ready) +kubectl uncordon woker-1-8gb-hel1-1 +``` + +## Notes + +- Do **NOT** upgrade `kubelet`/`kubeadm`/`kubectl` via apt without following the + upstream kubeadm cluster-upgrade procedure first. Pin those packages: + + ```bash + sudo apt-mark hold kubelet kubeadm kubectl kubernetes-cni + ``` + + Or check the held state with: `apt-mark showhold` +- If a kernel update is **not** in the upgrade set and you want to skip the + reboot, skip step 6 and go straight to uncordon after `apt upgrade`. +- Hetzner CSI/Cilium DaemonSets stay running during drain + (`--ignore-daemonsets`); that's expected and safe. \ No newline at end of file