AWS Builder Center

EKS upgrade from version 1.30 to 1.31

Learning from my recent implementation of EKS upgrade from version 1.30 to 1.31 using Terraform, AWS Blueprint and Karpenter.

Series: AWS EKS Version Upgrade (7 articles)

  1. …
  2. 7
    EKS upgrade from version 1.30 to 1.31 This article
In this article we will go through the changes required in Terraform script to upgrade an EKS cluster from 1.30 to 1.31. In addition, we will walk through the changes for Karpenter and AWS Blueprint.
PRE-Validate the EKS current version
1
aws eks describe-cluster --name sample --query cluster.version --output text
PRE-Validate EKS nodes
1
kubectl get nodes
Identify compatible AWS AMI for EKS 1.31 version
Identify the compatible AMI for EKS version 1.31 using below AWS CLI command and used it for version update.
1
2
3
aws ssm get-parameter --name /aws/service/eks/optimized-ami/<AWS EKS Version>/<your os>/recommended/image_id --region <AWS Region> --query "Parameter.Value" --output text.
sample:
aws ssm get-parameter --name /aws/service/eks/optimized-ami/1.31/amazon-linux-2/recommended/image_id --region eu-west-1 --query "Parameter.Value" --output text.
Following variables in Terraform scripts were updated:
The version of aws_eks_cluster resource was updated
1
2
3
4
resource "aws_eks_cluster" "example" {
name = "sample"
version = "1.31"
}
image_id in aws_launch_template resource (update the AMI we identified above as image_id)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# taken from https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template
resource "aws_launch_template" "foo" {
name = "foo"

block_device_mappings {
device_name = "/dev/sdf"

ebs {
volume_size = 20
}
}

capacity_reservation_specification {
capacity_reservation_preference = "open"
}

cpu_options {
core_count = 4
threads_per_core = 2
}

credit_specification {
cpu_credits = "standard"
}

disable_api_stop = true
disable_api_termination = true

ebs_optimized = true

iam_instance_profile {
name = "test"
}

image_id = "ami-test"

instance_initiated_shutdown_behavior = "terminate"

instance_market_options {
market_type = "spot"
}

instance_type = "t2.micro"

kernel_id = "test"

key_name = "test"

license_specification {
license_configuration_arn = "arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef"
}

metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
instance_metadata_tags = "enabled"
}

monitoring {
enabled = true
}

network_interfaces {
associate_public_ip_address = true
}

placement {
availability_zone = "us-west-2a"
}

ram_disk_id = "test"

vpc_security_group_ids = ["sg-12345678"]

tag_specifications {
resource_type = "instance"

tags = {
Name = "test"
}
}

user_data = filebase64("${path.module}/example.sh")
}
addon_version for each aws_eks_addon resource we want to update like vpc_cni , kube_proxy, coredns , etc.
1
2
3
4
5
6
7
resource "aws_eks_addon" "example" {
cluster_name = aws_eks_cluster.example.name
addon_name = "coredns"
addon_version = "v1.11.4-eksbuild.14"
resolve_conflicts_on_update = "PRESERVE"
}

All the other add-ons were updated to below versions:
1
2
3
4
5
6
coredns_version = "v1.11.4-eksbuild.14"
vpc_cni_version = "v1.19.6-eksbuild.1"
kube_proxy_version = "v1.31.9-eksbuild.2"
ebs_csi_version = "v1.45.0-eksbuild.2"
efs_csi_version = "v2.0.2-eksbuild.1"
s3_csi_version = "v1.14.1-eksbuild.1"
The above updates ensured master node of AWS EKS is updated, all worker nodes of AWS EKS are updated and Addons are updated to expected versions.
AWS Blueprint was retained with below version 1.21.0 and no changes were made for this upgrade. It retained the Karpenter in version 0.37.0. Karpenter was not upgraded and planned to be upgraded during net upgrade to 1.32 version.
1
2
3
4
5
module "eks-blueprints-addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "1.21.0"
# insert the 4 required variables here
}
Once the update is completed, verify the versions of Kubernetes and its nodes using the AWS CLI mentioned above in pre-validation.

Series: AWS EKS Version Upgrade (7 articles)

  1. …
  2. 7
    EKS upgrade from version 1.30 to 1.31 This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article