eksctl icon indicating copy to clipboard operation
eksctl copied to clipboard

Managed Node Group Create Failed - Ec2SubnetInvalidConfiguration Health issue type

Open kellen-dunham opened this issue 6 years ago • 11 comments

Please search existing issues (open & closed) to see if there is a similar one. If there is, add comments or vote where appropriate.

If you did not find a similar issue or if it did not help then ask for help in our slack channel

What help do you need? Describe the type of help you need. Please include your config, removing any sensitive information, or exact commands you're using.

I have created a new EKS cluster with public and private networking support via a config.yaml and using existing VPC subnets. Managed node groups placed on the public subnets (with Auto Public IP enabled and a route table with default route to IGW) create fine and nodes join cluster OK. However managed node groups placed on the private subnets (with Auto Public IP disabled and a route table with default route to NGW), fail to create. The error received is:

Ec2SubnetInvalidConfiguration - One or more Amazon EC2 Subnets of [subnet-A, subnet-B] for node group the-private-managed-ng-1 does not automatically assign public IP addresses to instances launched into it. If you want your instances to be assigned a public IP address, then you need to enable auto-assign public IP address for the subnet. See IP addressing in VPC guide: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#subnet-public-ip

Also note that I can set the private Auto Public IP to enabled, create a managed node group, then turn public IP off the subnet, terminate an instance, wait for a new instance to come up. In this setup the new instance does not have a public IP and can join the cluster OK, however the node group is now in a "Degraded" state and lists the above health issue.

I have reason to believe that there is something that I am not setting correctly in eksctl config yaml to create the cluster and / or managed node group. I've tried several times yesterday with different configs but each attempt seems to result in the same error - and it takes a while to test each cluster since cluster create / modification takes a long time.

Is there something that I am not setting up properly? Here is an example config I am using:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: test-eks-cluster-1
  region: us-east-1
  version: "1.18"
vpc:
 id: vpc-A
  subnets:
    private:
      us-east-1c: { id: subnet-A }
      us-east-1e: { id: subnet-B }
    public:
      us-east-1c: { id: subnet-C }
      us-east-1e: { id: subnet-D }
  clusterEndpoints:
    privateAccess: true
    publicAccess: true
managedNodeGroups:
- name: test-public-managed-ng-1
  amiFamily: AmazonLinux2
  instanceType: t3.medium
  desiredCapacity: 2
  volumeSize: 20
  volumeEncrypted: true
  ssh:
    allow: false # will use ~/.ssh/id_rsa.pub as the default ssh key
- name: test-private-managed-ng-1
  amiFamily: AmazonLinux2
  instanceType: t3.medium
  desiredCapacity: 2
  volumeSize: 20
  volumeEncrypted: true
  privateNetworking: true
  ssh:
    allow: false # will use ~/.ssh/id_rsa.pub as the default ssh key

kellen-dunham avatar Nov 13 '20 14:11 kellen-dunham

This appears to be resolved if I set the auto assigned public IP to be enabled on all subnets, and then use a custom launch template which adds a blank ENI and specifies to not assign a public IP.

The intent of this particular cluster is to have nodes exist in only public subnets or only private subnets. Ideally I could get this functionality from the eksctl yaml alone instead of having to define a launch template, but I haven't figure that out yet. I appreciate any help on the subject.

kellen-dunham avatar Nov 13 '20 19:11 kellen-dunham

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jan 18 '21 14:01 github-actions[bot]

@kellen-dunham Can you confirm what the RouteTable looks like for your private subnets?

The reason I ask is that this error has been known to appear when the private subnets aren't actually private

michaelbeaumont avatar Jan 21 '21 14:01 michaelbeaumont

@michaelbeaumont Thanks for this information. The subnets have a NAT gateway for default and a /32 to an IGW right now for debug/admin purposes. I can remove the /32 IGW and try again. Also I see that they are using the privateCluster config, I'll add that as well see if it helps. The goal is to keep the NAT gateway so that nodes have internet but to remove the public IP from the nodes.

kellen-dunham avatar Jan 21 '21 15:01 kellen-dunham

@michaelbeaumont I was able to create the managed node groups once I removed the IGW from the private subnet. Thanks for the help!!

kellen-dunham avatar Jan 26 '21 21:01 kellen-dunham

Great to hear it's working!

michaelbeaumont avatar Jan 26 '21 21:01 michaelbeaumont

For all those in the future searching for the following AWS Cloudformation Console error:

One or more Amazon EC2 Subnets of [subnet-???????, subnet-???????] for node group "primary" does not automatically assign public IP addresses to instances launched into it. If you want your instances to be assigned a public IP address, then you need to enable auto-assign public IP address for the subnet

As so succintly noted in the above chat.. .. check your "private" subnets thoroughly. Either they have an IGW associated with them, or a ROUTE-TABLE entry for the IGW, or some such silly setting. Removing that fixes this issue.

FYI only: I was facing this same issue, when deploying CFT (for my 1st "default" NodeGroup) onto my new "blank" EKS Cluster.

P.S: Don't ask .. ..how on earth did I add an IGW entry to a "Private" subnet.

seetamraju avatar Nov 04 '22 23:11 seetamraju

@seetamraju Thanks for this comment, you saved us a lot of time scratching our heads and thinking "what's going on here",

If someone from the EKS team reads this, please document this in the EKS documentation.

Burekasim avatar Dec 25 '22 08:12 Burekasim

hello everyone I needs run my node group under private network that not allocate ippublic to my vm, I already add privateNetworking: "true" it looks not working, do we still need public ip association within private subnet?

mftzk avatar Sep 07 '23 07:09 mftzk

hello everyone I needs run my node group under private network that not allocate ippublic to my vm, I already add privateNetworking: "true" it looks not working, do we still need public ip association within private subnet?

@mftzk, private subnets should not have the MapPublicIpOnLaunch field set to true. How did you create the cluster?

cPu1 avatar Sep 08 '23 06:09 cPu1

For all those in the future searching for the following AWS Cloudformation Console error:

One or more Amazon EC2 Subnets of [subnet-???????, subnet-???????] for node group "primary" does not automatically assign public IP addresses to instances launched into it. If you want your instances to be assigned a public IP address, then you need to enable auto-assign public IP address for the subnet

As so succintly noted in the above chat.. .. check your "private" subnets thoroughly. Either they have an IGW associated with them, or a ROUTE-TABLE entry for the IGW, or some such silly setting. Removing that fixes this issue.

FYI only: I was facing this same issue, when deploying CFT (for my 1st "default" NodeGroup) onto my new "blank" EKS Cluster.

P.S: Don't ask .. ..how on earth did I add an IGW entry to a "Private" subnet.

Thanks @seetamraju , This helped us.

raghureddycloud avatar Oct 10 '24 06:10 raghureddycloud