-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws-eks): EKS Cluster does not respect vpcSubnets #17023
Comments
Splitting the deployment like this: const kube = new Cluster(this, 'KubeCluster', {
version: KubernetesVersion.V1_21,
vpc,
vpcSubnets: [
vpc.selectSubnets({ subnetGroupName: 'Ingress' }),
vpc.selectSubnets({ subnetGroupName: 'Application' }),
],
defaultCapacity: 0,
});
kube.addNodegroupCapacity('PrivateCapacity', {
subnets: vpc.selectSubnets({ subnetGroupName: 'Application' }),
}); Does work for me. |
This is because the subnets you pass into your cluster don't get passed to the automatically created nodegroup. First, this function is called in the Cluster constructor aws-cdk/packages/@aws-cdk/aws-eks/lib/cluster.ts Lines 1322 to 1323 in 1d3883a
The implementation of this function looks like this aws-cdk/packages/@aws-cdk/aws-eks/lib/cluster.ts Lines 1416 to 1421 in 1d3883a
And this is inside the NodeGroup constructor aws-cdk/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Lines 377 to 381 in 1d3883a
So, things are working here as intended :) Though I can see why confusion occurred. @otaviomacedo is there any action we can take here to make this more intuitive? |
Closes #17023. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Closes aws#17023. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
What is the problem?
When using aws-eks to provision a cluster, I pass in explicit subnets. However, the underlying node group uses different sunbets.
Reproduction Steps
Intended CFN Output. These subnet Ids correlate to "Ingress" and "Application" subnets
However, these subnets correlate to a database subnet (which has NACLs applied to only allow DB traffic) causing the deployment to fail.
What did you expect to happen?
I intended for EKS to only use the subnets that I explicitly pointing out (but it looks like it's stealing private subnets from the passed in VPC)
What actually happened?
EKS Cluster used a non-intended subnet for node cluster provisioning
CDK CLI Version
1.127.0
Framework Version
1.127.0
Node.js Version
v14.18.0
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: