GSA-TTS / datagov-brokerpak-eks

Broker AWS EKS instances using the OSBAPI (eg from cloud.gov)
Other
9 stars 7 forks source link

Restrict acess to EKS Control Plane #101

Closed nickumia-reisys closed 2 years ago

nickumia-reisys commented 2 years ago

Related to https://github.com/GSA/data.gov/issues/3744

New Additions:

Cool References (hidden in commits):

nickumia-reisys commented 2 years ago

Okay, I think I figured out the real problem... hopefully the next test works.. it's based on the following output,

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | select(.region | contains("us-west-2")) | select(.service | contains("EC2")) | .ip_prefix'
nickumia-reisys commented 2 years ago

Granted.. that would have worked, but it also wouldn't have been a good solution at all..

So the problem are the Load Balancer IPs. When the repo gets to the part where it's specifying kubernetes resources and communicating with the control plane to create those resources, it's communicating with the control plane through public methods, specifically by going through the Load Balancer. Because the Load Balancer is created after the EKS module is complete, the Load Balancer IPs can't be added to the list of allowed IPs because they are not known at that time.

I guess the real solution is re-routing those k8s calls through the private control plane endpoint.. will try and investigate...

nickumia-reisys commented 2 years ago

Okay, well, everything is setup for cluster node to control plane traffic to be private, but maybe something about how the Terraform code calls k8s resources forces it to originate from the Load Balancer as opposed to internal node IPs..

References:

Two examples of the k8s resources originating from non-internal IPs:

Those IPs are regular EC2 node IPs, image

Very much similar to the EC2 IP of the Network Interface attached to the Load Balancer, image

The only solutions I can think of are:

@mogul Any ideas would be greatly appreciated..

nickumia-reisys commented 2 years ago

Reference on how to look up the EC2 IPs mapped to the Load Balancers.