Skip to content

Commit 1f30b5d

Browse files
authored
chore(eks): improve the doc on updating clusters (#29283)
### Issue # (if applicable) As described in #29282 , when renaming the cluster, an additional temporary IAM policy will be required. I am proposing the doc update to clarify this with this PR. Closes #29282 #24174 ### Reason for this change To address this use case. ### Description of changes ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ccb07d0 commit 1f30b5d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

+24
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ In addition, the library also supports defining Kubernetes resource manifests wi
1515
- [Node Groups with IPv6 Support](#node-groups-with-ipv6-support)
1616
- [Spot Instances Support](#spot-instances-support)
1717
- [Launch Template Support](#launch-template-support)
18+
- [Update clusters](#update-clusters)
1819
- [Fargate profiles](#fargate-profiles)
1920
- [Self-managed nodes](#self-managed-nodes)
2021
- [Spot Instances](#spot-instances)
@@ -366,6 +367,29 @@ You may specify one `instanceType` in the launch template or multiple `instanceT
366367
Graviton 2 instance types are supported including `c6g`, `m6g`, `r6g` and `t4g`.
367368
Graviton 3 instance types are supported including `c7g`.
368369

370+
### Update clusters
371+
372+
When you rename the cluster name and redeploy the stack, the cluster replacement will be triggered and
373+
the existing one will be deleted after the new one is provisioned. As the cluster resource ARN has been changed,
374+
the cluster resource handler would not be able to delete the old one as the resource ARN in the IAM policy
375+
has been changed. As a workaround, you need to add a temporary policy to the cluster admin role for
376+
successful replacement. Consider this example if you are renaming the cluster from `foo` to `bar`:
377+
378+
```ts
379+
const cluster = new eks.Cluster(this, 'cluster-to-rename', {
380+
clusterName: 'foo', // rename this to 'bar'
381+
version: eks.KubernetesVersion.V1_29,
382+
});
383+
384+
// allow the cluster admin role to delete the cluster 'foo'
385+
cluster.adminRole.addToPolicy(new iam.PolicyStatement({
386+
actions: ['eks:DeleteCluster'],
387+
resources: [
388+
Stack.of(this).formatArn({ service: 'eks', resource: 'cluster', resourceName: 'foo' }),
389+
]
390+
}))
391+
```
392+
369393
### Fargate profiles
370394

371395
AWS Fargate is a technology that provides on-demand, right-sized compute

0 commit comments

Comments
 (0)