Skip to content

Private Cluster creation fails if an existing VPC uses the same RouteTable #2473

@hiraken-w

Description

@hiraken-w

What happened?

When creating a Private Cluster with user-supplied VPC, if the subnets use the same RouteTable, cluster creation fails with the following error.

$ eksctl create cluster -f cluster.yaml
[ℹ]  eksctl version 0.24.0
[ℹ]  using region us-west-2
[✔]  using existing VPC (vpc-XXX...XXX) and subnets (private:[subnet-XXX...XXX subnet-XXX...XXX subnet-XXX...XXX] public:[])
[!]  custom VPC/subnets will be used; if resulting cluster doesn't function as expected, make sure to review the configuration of VPC/subnets
[ℹ]  using Kubernetes version 1.16
[ℹ]  creating EKS cluster "private-cluster" in "us-west-2" region with
[ℹ]  will create a CloudFormation stack for cluster itself and 0 nodegroup stack(s)
[ℹ]  will create a CloudFormation stack for cluster itself and 0 managed nodegroup stack(s)
[ℹ]  if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-west-2 --cluster=private-cluster'
[ℹ]  CloudWatch logging will not be enabled for cluster "private-cluster" in "us-west-2"
[ℹ]  you can enable it with 'eksctl utils update-cluster-logging --region=us-west-2 --cluster=private-cluster'
[ℹ]  Kubernetes API endpoint access will use provided values {publicAccess=true, privateAccess=true} for cluster "private-cluster" in "us-west-2"
[ℹ]  2 sequential tasks: { create cluster control plane "private-cluster", update cluster VPC endpoint access configuration }
[ℹ]  building cluster stack "eksctl-private-cluster-cluster"
[ℹ]  deploying stack "eksctl-private-cluster-cluster"
[✖]  unexpected status "ROLLBACK_COMPLETE" while waiting for CloudFormation stack "eksctl-private-cluster-cluster"
[ℹ]  fetching stack events in attempt to troubleshoot the root cause of the failure
[!]  AWS::EC2::SecurityGroup/ClusterSharedNodeSecurityGroup: DELETE_IN_PROGRESS
[!]  AWS::IAM::Role/ServiceRole: DELETE_IN_PROGRESS
[✖]  AWS::EC2::SecurityGroup/ClusterSharedNodeSecurityGroup: CREATE_FAILED – "Resource creation cancelled"
[✖]  AWS::IAM::Role/ServiceRole: CREATE_FAILED – "Resource creation cancelled"
[✖]  AWS::EC2::SecurityGroup/ControlPlaneSecurityGroup: CREATE_FAILED – "Resource creation cancelled"
[✖]  AWS::EC2::VPCEndpoint/VPCEndpointS3: CREATE_FAILED – "Property RouteTableIds contains duplicate values."
[!]  1 error(s) occurred and cluster hasn't been created properly, you may wish to check CloudFormation console
[ℹ]  to cleanup resources, run 'eksctl delete cluster --region=us-west-2 --name=private-cluster'
[✖]  waiting for CloudFormation stack "eksctl-private-cluster-cluster": ResourceNotReady: failed waiting for successful resource state
Error: failed to create cluster "private-cluster"

This is because the same RouteTable Ids are output to RouteTableIds of VPCEndpointS3 in the generated CloudFormation template.

...
        "VPCEndpointS3": {
            "Type": "AWS::EC2::VPCEndpoint",
            "Properties": {
                "RouteTableIds": [
                    "rtb-AAA...AAA",
                    "rtb-AAA...AAA",
                    "rtb-AAA...AAA"
                ],
                "ServiceName": "com.amazonaws.us-west-2.s3",
                "VpcEndpointType": "Gateway",
                "VpcId": "vpc-XXX...XXX"
            }
        },
...

What you expected to happen?

Private Cluster creation succeed when subnets use the same RouteTable.

How to reproduce it?

1. Prepare the configuration file

Use the following configuration file "cluster.yaml".

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: private-cluster1
  region: us-west-2

privateCluster:
  enabled: true

vpc:
  subnets:
    private:
      us-west-2a:
        id: subnet-aaaa
      us-west-2b:
        id: subnet-bbbb
      us-west-2c:
        id: subnet-cccc

Subnets (subnet-aaaa, subnet-bbbb, subnet-cccc) use the same route table.

2. execute the following eksctl command

eksctl create cluster -f cluster.yaml

As a result of the above execution, the issue can be reproduced.

Versions

$ eksctl version
0.24.0
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T23:30:39Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.6-eks-4e7f64", GitCommit:"4e7f642f9f4cbb3c39a4fc6ee84fe341a8ade94c", GitTreeState:"clean", BuildDate:"2020-06-11T13:55:35Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions