More Info:

Amazon Elastic Kubernetes Service (EKS) clusters should be using the latest stable version of Kubernetes container-orchestration system, in order to follow AWS best practices, receive the latest Kubernetes features, design updates and bug fixes, and benefit from better security and performance.

Risk Level

Low

Address

Security, Reliability, Performance

Compliance Standards

HIPAA, AWSWAF, HITRUST, NISTCSF

Remediation

Using Console

To remediate the misconfiguration “EKS Clusters Should Use The Latest Stable Version of Kubernetes” for AWS using the AWS console, follow the steps below:

  1. Log in to the AWS Management Console.
  2. Navigate to the Amazon EKS console.
  3. Select the EKS cluster that you want to update.
  4. Click on the “Update” button to update the cluster.
  5. In the “Update EKS Cluster” dialog box, select the latest stable version of Kubernetes from the “Kubernetes version” dropdown menu.
  6. Click on the “Next” button.
  7. Review the changes and click on the “Update” button to apply the changes.

Once the update is completed, your EKS cluster will be running on the latest stable version of Kubernetes. It is recommended to test your applications on the updated cluster to ensure that they are working as expected.

Using CLI

To remediate this misconfiguration for AWS EKS using AWS CLI, follow these steps:

  1. Open the AWS CLI and ensure that you have the necessary permissions to make changes to the EKS cluster.

  2. Check the current version of Kubernetes that is being used by the EKS cluster. Use the following command:

    aws eks describe-cluster --name <cluster-name> --query "cluster.version"
    
  3. Check the latest stable version of Kubernetes available for EKS. You can find this information in the AWS documentation or by using the following command:

    aws eks describe-cluster --name <cluster-name> --query "cluster.latestVersion"
    
  4. If the current version of Kubernetes is not the latest stable version, update the EKS cluster to use the latest version. Use the following command:

    aws eks update-cluster-version --name <cluster-name> --kubernetes-version <latest-version>
    

    Replace <cluster-name> with the name of your EKS cluster and <latest-version> with the latest stable version of Kubernetes available for EKS.

  5. Wait for the update to complete. You can check the status of the update using the following command:

    aws eks describe-update --name <cluster-name> --update-id <update-id> --query "update.status"
    

    Replace <cluster-name> with the name of your EKS cluster and <update-id> with the ID of the update.

  6. Once the update is complete, verify that the EKS cluster is now using the latest stable version of Kubernetes. Use the following command:

    aws eks describe-cluster --name <cluster-name> --query "cluster.version"
    

    The output should show the latest version of Kubernetes that you specified in step 4.

That’s it! Your EKS cluster is now using the latest stable version of Kubernetes.

Using Python

To remediate this misconfiguration for AWS EKS clusters using Python, you can follow the below steps:

Step 1: Install the AWS SDK for Python (Boto3) using the following command:

pip install boto3

Step 2: Use the Boto3 EKS client to describe the cluster and get the current Kubernetes version. You can use the following code snippet:

import boto3

# Create an EKS client
eks_client = boto3.client('eks')

# Describe the cluster to get the current Kubernetes version
cluster_name = '<your_cluster_name>'
response = eks_client.describe_cluster(name=cluster_name)
kubernetes_version = response['cluster']['version']

Step 3: Use the Boto3 EKS client to update the Kubernetes version of the cluster to the latest stable version. You can use the following code snippet:

import boto3

# Create an EKS client
eks_client = boto3.client('eks')

# Update the Kubernetes version of the cluster to the latest stable version
cluster_name = '<your_cluster_name>'
response = eks_client.update_cluster_version(name=cluster_name, version='latest')

Step 4: Verify that the Kubernetes version has been updated successfully by describing the cluster again. You can use the same code snippet as in Step 2.

import boto3

# Create an EKS client
eks_client = boto3.client('eks')

# Describe the cluster to verify the Kubernetes version
cluster_name = '<your_cluster_name>'
response = eks_client.describe_cluster(name=cluster_name)
kubernetes_version = response['cluster']['version']

Once you have completed these steps, you will have remediated the misconfiguration by updating the Kubernetes version of the AWS EKS cluster to the latest stable version.

Additional Reading: