EKS upgrade

·

2 min read

Upgrading a kubeadm cluster from 1.27 to 1.28

  • 1st create a cluster using d command

  • eksctl create cluster
    --name eks-cluster
    --version 1.27
    --with-oidc
    --nodegroup-name worker
    --region us-east-1
    --node-type t2.medium
    --ssh-access
    --ssh-public-key <key_name>

go to cluster → upgrade version

go to cluster → compute → rolling update → update


USING CLI;

Upgrading control plane nodes

#Upgrade kubeadm:
apt update
apt-cache madison kubeadm

apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm='1.28.x-*' && \
apt-mark hold kubeadm

kubeadm version
kubeadm upgrade plan
# replace x with the patch version you picked for this upgrade
sudo kubeadm upgrade apply v1.28.x

#Upgrade kubelet and kubectl
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

#Restart the kubelet:
sudo systemctl daemon-reload
sudo systemctl restart kubelet

Upgrading worker nodes

#Upgrade kubeadm:
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm='1.28.x-*' && \
apt-mark hold kubeadm
sudo kubeadm upgrade node

#Drain the node
kubectl drain <node-to-drain> --ignore-daemonsets

#Upgrade kubelet and kubectl
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

#Restart the kubelet:
sudo systemctl daemon-reload
sudo systemctl restart kubelet

#Uncordon the node
kubectl uncordon <node-to-uncordon>