Tag-based subnetSelectorTerms and securityGroupSelectorTerms discovery is not scoped to the cluster VPC

Author: cloudonlyCreated Sep 30, 2026Updated Sep 30, 2026

Observed Behavior:

EC2NodeClass subnet discovery via tags does not filter by the cluster's VPC. In an account hosting multiple EKS clusters, a wildcard tag selector such as:

yaml
subnetSelectorTerms:
  - tags:
      karpenter.sh/discovery-subnet: "*"

resolves subnets from other clusters' VPCs. We hit this in a shared account where the EC2NodeClass resolved two subnets in the same AZ (identifying data redacted):

Subnet VPC karpenter.sh/discovery-subnet tag value Available IPs
subnet-a the cluster's VPC cluster-a 868
subnet-b a different VPC (another cluster's) cluster-b 971

ZonalSubnetsForLaunch prefers the subnet with the most available IPs per zone, so the other-VPC subnet (971 > 868) won zonal selection. The resulting CreateFleet request carried a subnet from one VPC with security groups from the cluster's VPC, which EC2 rejects, so node launches failed.

Note that the two tag values differ — that is the point of the wildcard: karpenter.sh/discovery-subnet: "*" matches "any subnet that has this tag key", which crosses VPC boundaries in a shared account — restricting the AZ does not restrict the VPC. The same cross-VPC exposure exists for tag-based and name-based securityGroupSelectorTerms (security group names are unique per VPC, not per account).

Expected Behavior:

Tag-based and name-based subnet and security group discovery should be scoped to the cluster's VPC, which Karpenter can resolve once from eks:DescribeCluster (cluster.resourcesVpcConfig.vpcId). Discovery by explicit id can remain unscoped as an explicit user choice. Scoping cannot break supported topologies such as RAM/VPC sharing, because shared subnets still belong to the cluster's VPC.

Reproduction Steps (Please include YAML):

  1. In an account with two EKS clusters, tag one subnet in each cluster's VPC with the same tag key (e.g. karpenter.sh/discovery-subnet), where the other cluster's subnet has more free IPs in the same AZ.
  2. Create an EC2NodeClass with subnetSelectorTerms: [{tags: {karpenter.sh/discovery-subnet: "*"}}] and a NodePool using it.
  3. Schedule pods; observe status.subnets on the EC2NodeClass contains the other VPC's subnet, and CreateFleet launches fail with a subnet/security-group VPC mismatch.

Versions:

  • Chart Version: v1.8.3 (verified the discovery code is unchanged through v1.14.1)
  • Kubernetes Version (kubectl version): v1.34

I have a PR ready that scopes tag-based and name-based discovery to the cluster VPC.

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Source: aws/karpenter-provider-aws