Upgrade EKS 1.16 Cluster To EKS 1.17 Using EKSCTL In 6 Steps

In this blog, we will discuss the steps which are necessary for upgrading the EKS cluster from version 1.16 to version 1.17.

What is EKS?

EKS stands for Elastic Kubernetes Service, which is one of the services provided by AWS. It helps in running the Kubernetes on AWS without requiring the user to maintain their own Kubernetes control plane or the worker nodes.

Upgrading EKS Cluster Version:

The cluster managed or created by eksctl can be upgraded with below steps:

  1. Upgrade EKS plane
  2. Create New Node Group
  3. Update Kube-proxy (Kubernetes add-ons or Components)
  4. Update aws-node (Kubernetes add-ons or Components)
  5. Update core-dns (Kubernetes add-ons or Components)
  6. Drain and Delete Old Nodegroups

1.  Upgrade EKS Plane:

Commands to Upgrade the Control plane :

To upgrade EKS cluster plane to another version just run these simple commands:

$ eksctl upgrade cluster --name= --approve

Or

$ eksctl upgrade cluster --name= --approve

Or

You can do it via Yaml file which is given below:

$ cat cluster1.yaml
__

    apiVersion: eksctl.io/v1alpha5

    kind: ClusterConfig

    metadata:

    name: cluster-1

    region: eu-north-1

    version: “1.17”

$ eksctl upgrade cluster --config-file cluster1.yaml

NOTE:

Control plane version can be upgraded only by one minor version (For example 1.16 to 1.17 only), but you can upgrade your nodes up to two minor versions at a time.

When you upgrade the cluster, Amazon EKS requires 2-3 free IP addresses from the subnets which you provided at the time of cluster creation. If subnets do not have enough available IP addresses, then upgrade can fail and result in “InsufficientFreeAddresses” error.

If the EKS cluster has Fargate pods, check Fargate pod’s kublete version. If kubelet version is less than 1.16, recycle Fargate pods, so that their kubelet version will be 1.16. Otherwise, cluster upgrade will fail.

If any of the subnets or security groups that were provided during cluster creation have been deleted, the cluster upgrade process can fail.

When you update your cluster, Amazon EKS does not upgrade any of your Kubernetes add-ons. After updating your cluster, you have to update your add-ons version as well.

2.  Create New Node Group:

After running the above cluster upgrade commands, you are able to create or upgrade your node groups. You can create node groups in the following ways:

If you have single node group, you can create node group by CLI, run this command:

$ eksctl create nodegroup --cluster= --name=

If you have multiple node groups and have created them using a config file then, you can create node groups by config/yaml file also. Remove old node groups and add new node groups to this config file and then run command:

$ eksctl create nodegroup --config-file=

Above command will create new nodegroups

$ eksctl create nodegroup --config-file= --only-missing

Above command will delete older nodegroups

3. Update Kube-Proxy:

This command also supports the “–config-file” flag and also the command run in plan mode which is similar to dry-run. If you want to apply all the changes or the changes are as per your requirement you have re-run this command with the “–approve” flag . You can update kube-proxy by the following command.

$ eksctl utils update-kube-proxy

4.  Update aws-node:

This command also supports the “–config-file” flag and to apply all changes re-run with the “–approve” flag . You can update kube-proxy by the following command.

$ eksctl utils update-aws-node

5.  Update Core-DNS:

This command also supports the “–config-file” flag and to apply all the changes re-run with the “–approve” flag . You can update kube-proxy by the following command.

$ eksctl utils update-coredns

NOTE:

Once the above components are updated, you have to check whether all components are in running state or not, by running this command:

$ kubectl get pods -n kube-system

6.  Drain and Delete Old Node Groups:

Important: The drain action isolates the worker node and tells Kubernetes to stop scheduling any new pods on the node. To drain the node groups, run the following command and if you want to undo the draining use “–undo” with the command:

$ eksctl drain nodegroup --cluster= --name=

To delete the old node groups run the following commands:

$ eksctl drain nodegroup --cluster= --name=

If you are using config file to create and delete the node groups, then change the node groups in config file and run the following command with “–approve” flag:

$ eksctl delete nodegroup --config-file= --only-missing --approve

That’s all about upgrading the Amazon EKS cluster using eksctl.

Learn more about deploying on EKS using Devtron.