EKS Rolling Upgrade

Prerequisites:

  1. Upgrade kubectl to eks supported version.

  2. IAM Privileges to upgrade the cluster.

Step 1: Review the Release Notes

Before you begin upgrading your EKS cluster, it is essential to review the release notes for the new Kubernetes version. The release notes provide important information about the changes and improvements in the new version. Reviewing the release notes ensures that you understand any breaking changes or deprecations that may affect your workloads.

Step 2: Back Up Your EKS Cluster

Upgrading your EKS cluster is a critical operation that can potentially disrupt your production workloads. Therefore, it is essential to back up your EKS cluster before starting the upgrade process. You can use several tools to back up your EKS cluster, including Velero, which is an open-source tool for backing up Kubernetes clusters.

Step 3: Upgrade Your EKS Cluster Control Plane

The EKS cluster control plane manages the Kubernetes API server and other core components of the Kubernetes control plane. Upgrading the control plane is the first step in upgrading your EKS cluster. You can upgrade the control plane using the EKS console, the AWS CLI, the eksctl command-line tool or if you deploy your EKS cluster with an Infrastructure as a code (IaC) tool like terraform.

To upgrade the control plane using the EKS console, follow these steps:

  1. Open the EKS console and navigate to your cluster.

 

  1. Click the “Update” button in the upper right corner.

  2. Select “Upgrade control plane version” from the drop-down menu.

  3. Select the new Kubernetes version (Next Available Version) and click “Upgrade control plane.”

To update a node group version with the AWS Management Console

· Go to EC2 Console.

. Select the Launch Templates.

· Create a new launch template version with the new AMI ID

· check ami from aws official doc: https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html

· Upgrade the nodes to the new version of the launch template.

For Update strategy, select the following options:

· Rolling update — This option respects the pod disruption budgets for your cluster. Updates fail if there’s a pod disruption budget issue that causes Amazon EKS to be unable to gracefully drain the pods that are running on this node group.

· Choose Update.

Add-ons Upgrade:

  1. Post EKS Upgrade, Select Add-ons

  2. Update all the Installed add-ons to recommended versions.

 

EKS Upgrade Using Terraform:

Note: Please ensure you have the existing cluster state file and the IAM user who created the cluster with Terraform. Without these, the cluster upgrade will fail, and we won't be able to roll back to the previous version.

Prerequisites:
  1. Terraform

  2. Kubectl

  3. awscli

Steps

  1. Clone the DIGIT-DevOps repository:

Copy

git clone https://github.com/egovernments/DIGIT-DevOps.git
  1. Navigate to the cloned repository and checkout the release-1.28-Kubernetes branch:

Copy

cd DIGIT-DevOps git checkout release-1.28-kubernetes cd infra-as-code/terraform/sample-aws vi variables.tf
  1. update the kubernetes version to required version.

  1. Update the AMI ID with supported kubernets AMI version.

    vi main.tf

     

  2. Now run the following Commands.

5. Terraform plan has to show the changes made for the code update and those were EKS version and Add-ons version.

Note: if Plan is showing any updates non other than eks and add-ons, please skip the upgrade.

  1. Once the Plan shows expected results, run the apply command.

  1. After successfully applying the Terraform changes, you can verify the upgraded #Kubernetes version using either of the following methods:

    • Below command will display the client and server versions of #Kubernetes. Ensure that the server version matches the upgraded version (1.27).

    • Alternatively, you can check the #Kubernetes version directly in the AWS Management Console. Navigate to the EKS cluster you upgraded and check the #Kubernetes version displayed in the cluster details as shown in below picture.