aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

[aws-eks] EndpointAccess.PUBLIC/PUBLIC_AND_PRIVATE.onlyFrom() is not usable

Open stefanolczak opened this issue 6 years ago • 0 comments

When creating EKS Cluster there is a possibility to limit public access to endpoint only to specified CIDRs. The problem is that CDK uses lambdas ( KubectlProvider ) that do calls to API server by using kubectl. When public access is limited the lambdas can't connect to API server. I think the limiting should be only possible when using PUBLIC_AND_PRIVATE option and then CDK should configure the lambdas to connect to VPC to be able to access private endpoint. Currently the lambdas are connected to VPC only when using PRIVATE option because there is no check if public access is limited:

https://github.com/aws/aws-cdk/blob/4c8c6f1b4f564c5f0ef6ae95f635da431b619257/packages/%40aws-cdk/aws-eks/lib/cluster.ts#L1066-L1086

Limiting access in PUBLIC option is not usable at all because there is no way to access API server from lambdas then.

Reproduction Steps

  1. Create EKS cluster and set endpointAccess to PUBLIC.onlyFrom() or PUBLIC_AND_PRIVATE.onlyFrom()
  2. Notice that stack creation fails with errors from lambdas like:
Failed to create resource. Error: Operation failed after 3 attempts: b'W0820 12:01:21.086900      37 transport.go:243] Unable to cancel request for *exec.roundTripper\nerror: unable to recognize "/tmp/m
anifest.yaml": Get https://XXXXXXXXXXX.gr7.us-east-1.eks.amazonaws.com/api?timeout=32s: dial tcp X.Y.Z.Z:443: i/o timeout\n'

Environment

  • CLI Version : 1.60

This is :bug: Bug Report

stefanolczak avatar Aug 20 '20 12:08 stefanolczak