awslabs / aws-eks-cluster-controller

Manages EKS clusters in different AWS accounts using Custom Resources
Apache License 2.0
103 stars 30 forks source link

Make changes to support less than 3 AZs in a region #68

Open anand99 opened 5 years ago

anand99 commented 5 years ago

Right now https://github.com/awslabs/aws-eks-cluster-controller/blob/master/pkg/controller/controlplane/cfn_template.go#L46-L95 creates 3 Subnets in 3 different AZs, which are then used by Nodegroups to deploy the worker nodes.

This can be issue for deploying EKS cluster using aws-eks-cluster-controller where less than 3 AZs supported; For example ap-south-1(Mumbai) region where only 2 AZs available at the moment:

$ aws ec2 describe-availability-zones --region ap-south-1
{
    "AvailabilityZones": [
        {
            "State": "available",
            "Messages": [],
            "RegionName": "ap-south-1",
            "ZoneName": "ap-south-1a"
        },
        {
            "State": "available",
            "Messages": [],
            "RegionName": "ap-south-1",
            "ZoneName": "ap-south-1b"
        }
    ]
}

We may need to fix the Cloudformation template or make it dynamically generated using goformation

ckrough commented 5 years ago

Less than three AZ's leaves etcd without a good quorum. Do we want to enable support for that scenario?

MadVikingGod commented 5 years ago

We don't manage etcd, that is handled by EKS.

If they support a region that only has 2 AZs then we have to create the VPC with only 2 subnets. I think a solution to this would be to allow passing a list of AZs to create in. This would then have the bonus of supporting more than 3 AZs.

ckrough commented 5 years ago

Fair points. I remember now that was my argument for this when we spoke in person. Lulz.

anand99 commented 5 years ago

Confirmed, that when try to create eks cluster with region ap-south-1,

spec:
  accountId: "xxxxxx"
  controlPlane:
    clusterName: lunging-wolf-control-plane
  crossAccountRoleName: xxxxxxx
  region: ap-south-1

control-plane cloud-formation template fails with

Template error: Fn::Select cannot select nonexistent value at index 2

because of having 2 AZs in ap-south-1.

Even though it is failed the status in eks resource shows 'Complete',

status:
  status: Complete