Add support for vpc.controlPlaneOnPrivateSubnets - #8793
Open
guessi wants to merge 1 commit into
Open
Conversation
When eksctl creates a VPC, it passes both the public and the private subnets to the EKS API, so the control plane's cross-account ENIs are placed in public subnets as well. Restricting them to private subnets afterwards requires `eksctl utils update-cluster-vpc-config`, which calls the EKS API directly and leaves the cluster's CloudFormation stack out of sync. Add a `vpc.controlPlaneOnPrivateSubnets` field so that only the private subnets are passed to the EKS API at creation time. Public subnets are still created and used for NAT gateways and internet-facing load balancers, so this does not make the cluster fully private. The field is honoured for eksctl-created VPCs (IPv4 and IPv6, including fully-private clusters) and for pre-existing VPCs. It is rejected when combined with `vpc.controlPlaneSubnetIDs`, and when the configured private subnets do not cover at least two availability zones, which EKS requires. That last check is best-effort: subnets given only by ID have their zone resolved from EC2 after validation runs, so they are allowed through and rejected by the EKS API instead. Outposts are exempt, since the control plane there is already private-only. `eksctl utils update-cluster-vpc-config` rejects the field rather than silently ignoring it, and points at `vpc.controlPlaneSubnetIDs` instead. Control plane subnet selection is now built through a single helper. autoMode is passed into it rather than derived, so that it keeps applying only to VPCs that eksctl creates: the pre-existing VPC path has never restricted the control plane for Auto Mode clusters, and deriving it would have changed that behaviour for configurations that do not use the new field. Issue eksctl-io#8792 Signed-off-by: guessi <guessi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #8792.
When eksctl creates a VPC, it currently passes both the public and the private subnets to the EKS API, so the control plane's cross-account ENIs are placed in public subnets as well as private ones. Restricting them to private subnets afterwards requires
eksctl utils update-cluster-vpc-config, which calls the EKS API directly and leaves the cluster's CloudFormation stack out of sync with the actual configuration.This PR adds a
vpc.controlPlaneOnPrivateSubnetsfield so that only the private subnets are passed to the EKS API at cluster creation time. Public subnets are still created and used for NAT gateways and internet-facing load balancers — this does not make the cluster fully private, it only changes which subnets the control plane's ENIs land in.Key implementation points:
vpc.controlPlaneSubnetIDs, since that field already gives explicit control over control plane subnets.eksctl utils update-cluster-vpc-confignow rejects the field (rather than silently ignoring it) and points users atvpc.controlPlaneSubnetIDsinstead, since that command talks to the EKS API directly and can't keep the CloudFormation stack in sync.autoModeis passed into it rather than derived internally, so the new field keeps applying only to VPCs that eksctl creates — the pre-existing VPC path has never restricted the control plane for Auto Mode clusters, and derivingautoModethere would have changed that behaviour for configurations not using the new field.See
examples/49-control-plane-on-private-subnets.yamlfor a usage example, and the updateduserdocs/src/usage/cluster-subnets-security-groups.mdfor documentation.Checklist
README.md, or theuserdocsdirectory)area/nodegroup) and kind (e.g.kind/improvement)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯