Skip to content

Commit fdd3309

Browse files
authored
feat(eks): support eks with k8s 1.27 (#25897)
Similar to #25088, this PR add eks with k8s 1.27 support. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 54f91c8 commit fdd3309

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

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

+24-24
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ This example defines an Amazon EKS cluster with the following configuration:
3939
* A Kubernetes pod with a container based on the [paulbouwer/hello-kubernetes](https://github.com/paulbouwer/hello-kubernetes) image.
4040

4141
```ts
42-
import { KubectlV26Layer } from '@aws-cdk/lambda-layer-kubectl-v26';
42+
import { KubectlV27Layer } from '@aws-cdk/lambda-layer-kubectl-v27';
4343

4444
// provisioning a cluster
4545
const cluster = new eks.Cluster(this, 'hello-eks', {
46-
version: eks.KubernetesVersion.V1_26,
47-
kubectlLayer: new KubectlV26Layer(this, 'kubectl'),
46+
version: eks.KubernetesVersion.V1_27,
47+
kubectlLayer: new KubectlV27Layer(this, 'kubectl'),
4848
});
4949

5050
// apply a kubernetes manifest to the cluster
@@ -110,15 +110,15 @@ Creating a new cluster is done using the `Cluster` or `FargateCluster` construct
110110

111111
```ts
112112
new eks.Cluster(this, 'HelloEKS', {
113-
version: eks.KubernetesVersion.V1_26,
113+
version: eks.KubernetesVersion.V1_27,
114114
});
115115
```
116116

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

119119
```ts
120120
new eks.FargateCluster(this, 'HelloEKS', {
121-
version: eks.KubernetesVersion.V1_26,
121+
version: eks.KubernetesVersion.V1_27,
122122
});
123123
```
124124

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

143143
```ts
144144
new eks.Cluster(this, 'HelloEKS', {
145-
version: eks.KubernetesVersion.V1_26,
145+
version: eks.KubernetesVersion.V1_27,
146146
defaultCapacity: 5,
147147
defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.SMALL),
148148
});
@@ -154,7 +154,7 @@ Additional customizations are available post instantiation. To apply them, set t
154154

155155
```ts
156156
const cluster = new eks.Cluster(this, 'HelloEKS', {
157-
version: eks.KubernetesVersion.V1_26,
157+
version: eks.KubernetesVersion.V1_27,
158158
defaultCapacity: 0,
159159
});
160160

@@ -213,7 +213,7 @@ const eksClusterNodeGroupRole = new iam.Role(this, 'eksClusterNodeGroupRole', {
213213
});
214214

215215
const cluster = new eks.Cluster(this, 'HelloEKS', {
216-
version: eks.KubernetesVersion.V1_26,
216+
version: eks.KubernetesVersion.V1_27,
217217
defaultCapacity: 0,
218218
});
219219

@@ -356,7 +356,7 @@ The following code defines an Amazon EKS cluster with a default Fargate Profile
356356

357357
```ts
358358
const cluster = new eks.FargateCluster(this, 'MyCluster', {
359-
version: eks.KubernetesVersion.V1_26,
359+
version: eks.KubernetesVersion.V1_27,
360360
});
361361
```
362362

@@ -433,7 +433,7 @@ You can also configure the cluster to use an auto-scaling group as the default c
433433

434434
```ts
435435
const cluster = new eks.Cluster(this, 'HelloEKS', {
436-
version: eks.KubernetesVersion.V1_26,
436+
version: eks.KubernetesVersion.V1_27,
437437
defaultCapacityType: eks.DefaultCapacityType.EC2,
438438
});
439439
```
@@ -526,7 +526,7 @@ You can configure the [cluster endpoint access](https://docs.aws.amazon.com/eks/
526526

527527
```ts
528528
const cluster = new eks.Cluster(this, 'hello-eks', {
529-
version: eks.KubernetesVersion.V1_26,
529+
version: eks.KubernetesVersion.V1_27,
530530
endpointAccess: eks.EndpointAccess.PRIVATE, // No access outside of your VPC.
531531
});
532532
```
@@ -588,7 +588,7 @@ You can specify the VPC of the cluster using the `vpc` and `vpcSubnets` properti
588588
declare const vpc: ec2.Vpc;
589589

590590
new eks.Cluster(this, 'HelloEKS', {
591-
version: eks.KubernetesVersion.V1_26,
591+
version: eks.KubernetesVersion.V1_27,
592592
vpc,
593593
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }],
594594
});
@@ -635,7 +635,7 @@ You can configure the environment of the Cluster Handler functions by specifying
635635
```ts
636636
declare const proxyInstanceSecurityGroup: ec2.SecurityGroup;
637637
const cluster = new eks.Cluster(this, 'hello-eks', {
638-
version: eks.KubernetesVersion.V1_26,
638+
version: eks.KubernetesVersion.V1_27,
639639
clusterHandlerEnvironment: {
640640
https_proxy: 'http://proxy.myproxy.com',
641641
},
@@ -706,7 +706,7 @@ You can configure the environment of this function by specifying it at cluster i
706706

707707
```ts
708708
const cluster = new eks.Cluster(this, 'hello-eks', {
709-
version: eks.KubernetesVersion.V1_26,
709+
version: eks.KubernetesVersion.V1_27,
710710
kubectlEnvironment: {
711711
'http_proxy': 'http://proxy.myproxy.com',
712712
},
@@ -726,11 +726,11 @@ Depending on which version of kubernetes you're targeting, you will need to use
726726
the `@aws-cdk/lambda-layer-kubectl-vXY` packages.
727727

728728
```ts
729-
import { KubectlV26Layer } from '@aws-cdk/lambda-layer-kubectl-v26';
729+
import { KubectlV27Layer } from '@aws-cdk/lambda-layer-kubectl-v27';
730730

731731
const cluster = new eks.Cluster(this, 'hello-eks', {
732-
version: eks.KubernetesVersion.V1_26,
733-
kubectlLayer: new KubectlV26Layer(this, 'kubectl'),
732+
version: eks.KubernetesVersion.V1_27,
733+
kubectlLayer: new KubectlV27Layer(this, 'kubectl'),
734734
});
735735
```
736736

@@ -765,7 +765,7 @@ const cluster1 = new eks.Cluster(this, 'MyCluster', {
765765
kubectlLayer: layer,
766766
vpc,
767767
clusterName: 'cluster-name',
768-
version: eks.KubernetesVersion.V1_26,
768+
version: eks.KubernetesVersion.V1_27,
769769
});
770770

771771
// or
@@ -783,7 +783,7 @@ By default, the kubectl provider is configured with 1024MiB of memory. You can u
783783
```ts
784784
new eks.Cluster(this, 'MyCluster', {
785785
kubectlMemory: Size.gibibytes(4),
786-
version: eks.KubernetesVersion.V1_26,
786+
version: eks.KubernetesVersion.V1_27,
787787
});
788788

789789
// or
@@ -822,7 +822,7 @@ When you create a cluster, you can specify a `mastersRole`. The `Cluster` constr
822822
```ts
823823
declare const role: iam.Role;
824824
new eks.Cluster(this, 'HelloEKS', {
825-
version: eks.KubernetesVersion.V1_26,
825+
version: eks.KubernetesVersion.V1_27,
826826
mastersRole: role,
827827
});
828828
```
@@ -872,7 +872,7 @@ You can use the `secretsEncryptionKey` to configure which key the cluster will u
872872
const secretsKey = new kms.Key(this, 'SecretsKey');
873873
const cluster = new eks.Cluster(this, 'MyCluster', {
874874
secretsEncryptionKey: secretsKey,
875-
version: eks.KubernetesVersion.V1_26,
875+
version: eks.KubernetesVersion.V1_27,
876876
});
877877
```
878878

@@ -882,7 +882,7 @@ You can also use a similar configuration for running a cluster built using the F
882882
const secretsKey = new kms.Key(this, 'SecretsKey');
883883
const cluster = new eks.FargateCluster(this, 'MyFargateCluster', {
884884
secretsEncryptionKey: secretsKey,
885-
version: eks.KubernetesVersion.V1_26,
885+
version: eks.KubernetesVersion.V1_27,
886886
});
887887
```
888888

@@ -1172,7 +1172,7 @@ when a cluster is defined:
11721172

11731173
```ts
11741174
new eks.Cluster(this, 'MyCluster', {
1175-
version: eks.KubernetesVersion.V1_26,
1175+
version: eks.KubernetesVersion.V1_27,
11761176
prune: false,
11771177
});
11781178
```
@@ -1559,7 +1559,7 @@ property. For example:
15591559
```ts
15601560
const cluster = new eks.Cluster(this, 'Cluster', {
15611561
// ...
1562-
version: eks.KubernetesVersion.V1_26,
1562+
version: eks.KubernetesVersion.V1_27,
15631563
clusterLogging: [
15641564
eks.ClusterLoggingTypes.API,
15651565
eks.ClusterLoggingTypes.AUTHENTICATOR,

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

+9
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,15 @@ export class KubernetesVersion {
918918
*/
919919
public static readonly V1_26 = KubernetesVersion.of('1.26');
920920

921+
/**
922+
* Kubernetes version 1.27
923+
*
924+
* When creating a `Cluster` with this version, you need to also specify the
925+
* `kubectlLayer` property with a `KubectlV27Layer` from
926+
* `@aws-cdk/lambda-layer-kubectl-v27`.
927+
*/
928+
public static readonly V1_27 = KubernetesVersion.of('1.27');
929+
921930
/**
922931
* Custom cluster version
923932
* @param version custom version number

0 commit comments

Comments
 (0)