Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eks : changing subnets in EKS cluster fails #30886

Closed
lkoniecz opened this issue Jul 18, 2024 · 5 comments
Closed

eks : changing subnets in EKS cluster fails #30886

lkoniecz opened this issue Jul 18, 2024 · 5 comments
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/small Small work item – less than a day of effort p3

Comments

@lkoniecz
Copy link

lkoniecz commented Jul 18, 2024

Describe the bug

self.eks_cluster = aws_eks.Cluster(
  scope=self,
  id=id,
  cluster_name='SandboxEksCluster',
  #irrelevant parameters
)

by default it takes all available public and private subnets: https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_eks/Cluster.html

in my case 3 public and 3 private

changing it to

self.eks_cluster = aws_eks.Cluster(
  scope=self,
  id=id,
  cluster_name='SandboxEksCluster',
  vpc_subnets=[
      aws_ec2.SubnetSelection(
          subnets=vpc.select_subnets(subnet_type=aws_ec2.SubnetType.PUBLIC).subnets[:2]
      ),
      aws_ec2.SubnetSelection(
          subnets=vpc.select_subnets(subnet_type=aws_ec2.SubnetType.PRIVATE_WITH_EGRESS).subnets[:2]
      )
  ]
  #irrelevant parameters
)

Causes

sandbox-eks-cluster: deploying... [1/1]
sandbox-eks-cluster: creating CloudFormation changeset...
10:42:51 AM | UPDATE_FAILED        | Custom::AWSCDK-EKS-Cluster            | SandboxEksClusterCF446194
Received response status [FAILED] from custom resource. Message returned: Cannot replace cluster "SandboxEksCluster" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration

Logs: /aws/lambda/sandbox-eks-cluster-awscdka-OnEventHandler42BEBAE0-v8fCIC22c14U

at rB.onUpdate (/var/task/index.js:63:9919)
at rB.onEvent (/var/task/index.js:63:6862)
at Runtime.YS [as handler] (/var/task/index.js:63:16996)
at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29) (RequestId: bbdc1906-2c78-4480-87e9-954dda532309)

fix for #24162 does not work for me

diff: https://www.diffchecker.com/KYQvwKRE/

update vpc flag is set to true

2024-07-18T08:42:49.823Z	68c29b4a-2b61-4517-bca0-2c5e4a6ada2c	INFO	onUpdate: 
{
    "updates": {
        "replaceName": false,
        "replaceVpc": true,
        "updateAccess": false,
        "replaceRole": false,
        "updateVersion": false,
        "updateEncryption": false,
        "updateLogging": false
    }
}

Expected Behavior

Subnets are updated in place

Current Behavior

Error is raised, piece of stack trace in the description

Reproduction Steps

In the description

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.117.0 (build 59d9b23)

Framework Version

No response

Node.js Version

Node.js v18.17.1

OS

MacOS

Language

Python

Language Version

Python 3.12.2

Other information

No response

@lkoniecz lkoniecz added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2024
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Jul 18, 2024
@lkoniecz lkoniecz changed the title eks : changing subnets causes fails eks : changing subnets causes failure Jul 18, 2024
@lkoniecz lkoniecz changed the title eks : changing subnets causes failure eks : changing subnets in EKS cluster fails Jul 18, 2024
@lkoniecz
Copy link
Author

lkoniecz commented Jul 18, 2024

I might be missing #30114

@lkoniecz
Copy link
Author

lkoniecz commented Jul 18, 2024

This is what I am getting now

11:43:44 AM | UPDATE_FAILED        | Custom::AWSCDK-EKS-Cluster            | SandboxEksClusterCF446194
Received response status [FAILED] from custom resource. Message returned: Provided subnets belong to the AZs 'us-east-1a,us-east-1b'. But they should belong to the exact set of AZs 'us-east-1a,us-east-1b,us-east-1c' in which subnets were provided during cluster creation.

Logs: /aws/lambda/sandbox-eks-cluster-awscdka-OnEventHandler42BEBAE0-v8fCIC22c14U

at de_InvalidParameterExceptionRes (/var/runtime/node_modules/@aws-sdk/client-eks/dist-cjs/index.js:2575:21)
at de_CommandError (/var/runtime/node_modules/@aws-sdk/client-eks/dist-cjs/index.js:2473:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/core/dist-cjs/index.js:165:18
at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
at async /var/runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
at async Ti.onUpdate (/var/task/index.js:55:653505) (RequestId: d7b51798-7e11-4f6a-a842-4d13efdd15e9)

which looks like to be a limitation of the EKS cluster not the CDK

to be closed

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@pahud pahud added effort/small Small work item – less than a day of effort p3 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2024
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/small Small work item – less than a day of effort p3
Projects
None yet
Development

No branches or pull requests

3 participants