Upgrading a Kubernetes cluster(EKS inclusive)

Traditional Kubernetes cluster upgrade

An important consideration to make when upgrading your cluster is API depreciations(this has to do with old API versions which are no longer in use), if you have depreciated API versions, you will have to change your YAML manifest files and clients to reference the new APIs(recommended API version is v1), check Deprecated API Migration Guide | Kubernetes

kubectl get nodes
kubeadm version -o json
sudo kubeadm upgrade plan
sudo apt update
sudo apt-cache madison kubeadm | tac
sudo apt-mark unhold kubeadm && \
sudo apt-get update && sudo apt-get install -y kubeadm=1.24.6-00 && \
sudo apt-mark hold kubeadm
sudo kubeadm upgrade node
kubeadm version -o json
kubectl drain master-node --ignore-daemonsets
sudo kubectl drain master-node --ignore-daemonsets --delete-local-data
sudo apt-mark unhold kubelet kubectl && \
sudo apt-get update && sudo apt-get install -y kubelet=1.24.6-00 kubectl=1.24.6-00 && \
sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload
sudo systemctl restart kubelet
kubectl uncordon master-node
kubectl get nodes
sudo apt-mark unhold kubeadm && \
sudo apt-get update && sudo apt-get install -y kubeadm=1.24.6-00 && \
sudo apt-mark hold kubeadm
sudo kubeadm upgrade node
kubectl drain worker-node01 --ignore-daemonsets
sudo apt-mark unhold kubelet kubectl && \
sudo apt-get update && sudo apt-get install -y kubelet=1.24.6-00 kubectl=1.24.6-00 && \
sudo apt-mark hold kubelet kubectl
kubectl uncordon worker-node01
kubectl get nodes
kubectl get po -n kube-system

Upgrading your Amazon EKS cluster

These is a different upgrade process from the traditional kubernetes upgrade, but endeavor to check for API depreciations with that which match the cluster you are upgrading to(you can check the second paragraph on this article for more details on that)

eksctl upgrade cluster --name=eksworkshop-eksctl
[ℹ]  eksctl version 0.66.0
[ℹ] using region us-west-2
[ℹ] (plan) would upgrade cluster "eksworkshop-eksctl" control plane from current version "1.21" to "1.22"
[ℹ] re-building cluster stack "eksctl-eksworkshop-eksctl-cluster"
[✔] all resources in cluster stack "eksctl-eksworkshop-eksctl-cluster" are up-to-date
[ℹ] checking security group configuration for all nodegroups
[ℹ] all nodegroups have up-to-date configuration
[!] no changes were applied, run again with '--approve' to apply the changes
eksctl upgrade cluster --name=eksworkshop-eksctl --approve
  • kubeproxy
  • CoreDNS
  • aws-node (AWS CNI or Network Plugin)
eksctl utils update-kube-proxy --cluster=eksworkshop-eksctl --approve

eksctl utils update-coredns --cluster=eksworkshop-eksctl --approve
kubectl get daemonset kube-proxy --namespace kube-system -

kubectl describe deployment coredns --namespace kube-system | grep Image | cut -d "/" -f 3
kubectl scale deployments/cluster-autoscaler --replicas=0 -n kube-system
eksctl upgrade nodegroup --name=nodegroup --cluster=eksworkshop-eksctl --kubernetes-version=1.22
kubectl get nodes --watch

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex Emeka Izuka

Alex Emeka Izuka

7 Followers

A Devops engineer integrating project functions and resources across the product lifecycle; from planning, building, testing till deployment.