Skip to content

Commit 792e3f2

Browse files
authored
feat(eks): support for Kubernetes version 1.26 (#25088)
Depends on cdklabs/awscdk-asset-kubectl#242 <img width="1120" alt="image" src="https://user-images.githubusercontent.com/31543/232162919-880ba489-9d32-4ce3-99df-cd35dfe184cf.png"> Closes #25087 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent cefbb33 commit 792e3f2

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

packages/aws-cdk-lib/aws-eks/README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ import { KubectlV25Layer } from '@aws-cdk/lambda-layer-kubectl-v25';
4242

4343
// provisioning a cluster
4444
const cluster = new eks.Cluster(this, 'hello-eks', {
45-
version: eks.KubernetesVersion.V1_25,
46-
kubectlLayer: new KubectlV25Layer(this, 'kubectl'),
45+
version: eks.KubernetesVersion.V1_26,
46+
kubectlLayer: new KubectlV26Layer(this, 'kubectl'),
4747
});
4848

4949
// apply a kubernetes manifest to the cluster
@@ -136,15 +136,15 @@ Creating a new cluster is done using the `Cluster` or `FargateCluster` construct
136136

137137
```ts
138138
new eks.Cluster(this, 'HelloEKS', {
139-
version: eks.KubernetesVersion.V1_21,
139+
version: eks.KubernetesVersion.V1_26,
140140
});
141141
```
142142

143143
You can also use `FargateCluster` to provision a cluster that uses only fargate workers.
144144

145145
```ts
146146
new eks.FargateCluster(this, 'HelloEKS', {
147-
version: eks.KubernetesVersion.V1_21,
147+
version: eks.KubernetesVersion.V1_26,
148148
});
149149
```
150150

@@ -168,7 +168,7 @@ At cluster instantiation time, you can customize the number of instances and the
168168

169169
```ts
170170
new eks.Cluster(this, 'HelloEKS', {
171-
version: eks.KubernetesVersion.V1_21,
171+
version: eks.KubernetesVersion.V1_26,
172172
defaultCapacity: 5,
173173
defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.SMALL),
174174
});
@@ -180,7 +180,7 @@ Additional customizations are available post instantiation. To apply them, set t
180180

181181
```ts
182182
const cluster = new eks.Cluster(this, 'HelloEKS', {
183-
version: eks.KubernetesVersion.V1_21,
183+
version: eks.KubernetesVersion.V1_26,
184184
defaultCapacity: 0,
185185
});
186186

@@ -571,7 +571,7 @@ You can specify the VPC of the cluster using the `vpc` and `vpcSubnets` properti
571571
declare const vpc: ec2.Vpc;
572572

573573
new eks.Cluster(this, 'HelloEKS', {
574-
version: eks.KubernetesVersion.V1_21,
574+
version: eks.KubernetesVersion.V1_26,
575575
vpc,
576576
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }],
577577
});
@@ -618,7 +618,7 @@ You can configure the environment of the Cluster Handler functions by specifying
618618
```ts
619619
declare const proxyInstanceSecurityGroup: ec2.SecurityGroup;
620620
const cluster = new eks.Cluster(this, 'hello-eks', {
621-
version: eks.KubernetesVersion.V1_21,
621+
version: eks.KubernetesVersion.V1_26,
622622
clusterHandlerEnvironment: {
623623
https_proxy: 'http://proxy.myproxy.com',
624624
},
@@ -656,7 +656,7 @@ You can configure the environment of this function by specifying it at cluster i
656656

657657
```ts
658658
const cluster = new eks.Cluster(this, 'hello-eks', {
659-
version: eks.KubernetesVersion.V1_21,
659+
version: eks.KubernetesVersion.V1_26,
660660
kubectlEnvironment: {
661661
'http_proxy': 'http://proxy.myproxy.com',
662662
},
@@ -676,11 +676,11 @@ Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a differ
676676
version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` packages.
677677

678678
```ts
679-
import { KubectlV25Layer } from '@aws-cdk/lambda-layer-kubectl-v25';
679+
import { KubectlV26Layer } from '@aws-cdk/lambda-layer-kubectl-v26';
680680

681681
const cluster = new eks.Cluster(this, 'hello-eks', {
682-
version: eks.KubernetesVersion.V1_25,
683-
kubectlLayer: new KubectlV25Layer(this, 'kubectl'),
682+
version: eks.KubernetesVersion.V1_26,
683+
kubectlLayer: new KubectlV26Layer(this, 'kubectl'),
684684
});
685685
```
686686

@@ -715,7 +715,7 @@ const cluster1 = new eks.Cluster(this, 'MyCluster', {
715715
kubectlLayer: layer,
716716
vpc,
717717
clusterName: 'cluster-name',
718-
version: eks.KubernetesVersion.V1_21,
718+
version: eks.KubernetesVersion.V1_26,
719719
});
720720

721721
// or
@@ -733,7 +733,7 @@ By default, the kubectl provider is configured with 1024MiB of memory. You can u
733733
```ts
734734
new eks.Cluster(this, 'MyCluster', {
735735
kubectlMemory: Size.gibibytes(4),
736-
version: eks.KubernetesVersion.V1_21,
736+
version: eks.KubernetesVersion.V1_26,
737737
});
738738

739739
// or
@@ -772,7 +772,7 @@ When you create a cluster, you can specify a `mastersRole`. The `Cluster` constr
772772
```ts
773773
declare const role: iam.Role;
774774
new eks.Cluster(this, 'HelloEKS', {
775-
version: eks.KubernetesVersion.V1_21,
775+
version: eks.KubernetesVersion.V1_26,
776776
mastersRole: role,
777777
});
778778
```
@@ -800,7 +800,7 @@ You can use the `secretsEncryptionKey` to configure which key the cluster will u
800800
const secretsKey = new kms.Key(this, 'SecretsKey');
801801
const cluster = new eks.Cluster(this, 'MyCluster', {
802802
secretsEncryptionKey: secretsKey,
803-
version: eks.KubernetesVersion.V1_21,
803+
version: eks.KubernetesVersion.V1_26,
804804
});
805805
```
806806

@@ -810,7 +810,7 @@ You can also use a similar configuration for running a cluster built using the F
810810
const secretsKey = new kms.Key(this, 'SecretsKey');
811811
const cluster = new eks.FargateCluster(this, 'MyFargateCluster', {
812812
secretsEncryptionKey: secretsKey,
813-
version: eks.KubernetesVersion.V1_21,
813+
version: eks.KubernetesVersion.V1_26,
814814
});
815815
```
816816

@@ -1100,7 +1100,7 @@ when a cluster is defined:
11001100

11011101
```ts
11021102
new eks.Cluster(this, 'MyCluster', {
1103-
version: eks.KubernetesVersion.V1_21,
1103+
version: eks.KubernetesVersion.V1_26,
11041104
prune: false,
11051105
});
11061106
```
@@ -1485,7 +1485,7 @@ property. For example:
14851485
```ts
14861486
const cluster = new eks.Cluster(this, 'Cluster', {
14871487
// ...
1488-
version: eks.KubernetesVersion.V1_21,
1488+
version: eks.KubernetesVersion.V1_26,
14891489
clusterLogging: [
14901490
eks.ClusterLoggingTypes.API,
14911491
eks.ClusterLoggingTypes.AUTHENTICATOR,

packages/aws-cdk-lib/aws-eks/lib/cluster.ts

+9
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,15 @@ export class KubernetesVersion {
885885
*/
886886
public static readonly V1_25 = KubernetesVersion.of('1.25');
887887

888+
/**
889+
* Kubernetes version 1.26
890+
*
891+
* When creating a `Cluster` with this version, you need to also specify the
892+
* `kubectlLayer` property with a `KubectlV26Layer` from
893+
* `@aws-cdk/lambda-layer-kubectl-v26`.
894+
*/
895+
public static readonly V1_26 = KubernetesVersion.of('1.26');
896+
888897
/**
889898
* Custom cluster version
890899
* @param version custom version number

0 commit comments

Comments
 (0)