Kubeadm upgrade nodes

From UVOO Tech Wiki
Revision as of 04:23, 23 December 2024 by Busk (talk | contribs) (Created page with "``` #!/bin/bash # Update the package lists sudo apt update # Install the Kubernetes packages, specifying the desired version sudo apt install -y kubelet=1.31.* kubeadm=1.31....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/bin/bash

# Update the package lists
sudo apt update

# Install the Kubernetes packages, specifying the desired version
sudo apt install -y kubelet=1.31.* kubeadm=1.31.* kubectl=1.31.* 

# Restart kubelet service
sudo systemctl restart kubelet


apt-get upgrade
# Verify node status
kubectl get nodes -o wide

# Optional: Drain the node before upgrading to avoid disruptions
# kubectl drain <node-name> --ignore-daemon-sets --force --delete-local-data 

# Optional: Upgrade other node components (e.g., containerd, Docker)
# - Follow the specific upgrade instructions for your container runtime

# Note:
# - This script assumes you have the Kubernetes repository configured in your system.
# - This script uses wildcards to install the latest patch version within the 1.31 series.
# - This script performs a rolling update. Consider draining nodes for zero-downtime upgrades.
# - Always back up critical data before performing any upgrades.
# - Refer to the official Kubernetes documentation for the most up-to-date instructions.