-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
We have multiple EKS clusters, in multiple VPCs. That being said, we plan to have a centralized VPC just for ingress, following this pattern: https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/using-network-firewall-for-centralized-ingress.html
Since less is more, we want to keep the number of hops as low as possible, so we plan to have the following traffic setup:
Browser -> PUBLIC_ALB_IN_THE_INGRESS_ACCOUNT -> IP_OF_THE_EKS_POD_IN_THE_APPLICATION_ACCOUNT
That means we have at least two AWS accounts: INGRESS_ACCOUNT and APPLICATION_ACCOUNT
Our current setup is created with terraform, including the EKS cluster, the ALB, the DNS entry, the ALB rule and the ALB target group.
Which means the only thing that the aws-load-balancer-controller
has to do is to sync the IPs of the k8s service with the target group.
For that, we use TargetGroupBindings
( https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.7/guide/targetgroupbinding/targetgroupbinding/ )
Just for reference, this is what a TargetGroupBinding
look like:
apiVersion: elbv2.k8s.aws/v1beta1
kind: TargetGroupBinding
metadata:
name: my-tgb
spec:
serviceRef:
name: awesome-service # route traffic to the awesome-service
port: 80
targetGroupARN: <arn-to-targetGroup>
So what we need is for the aws-load-balancer-controller
to be able to interact with the target groups in different AWS accounts.
More specifically, we need this IAM permission on different AWS accounts:
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:ModifyTargetGroup",
"elasticloadbalancing:ModifyTargetGroupAttributes",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:DeregisterTargets"
Ideally, we should be able to do that with AWS RAM, but AWS RAM can only share whole VPCs, which not something my security team is happy about.
So what I suggest we do in order to solve that problem is to patch the aws-load-balancer-controller
to allow it to impersonate arbitrary IAM roles per TargetGroupBinding
. This way we could solve not only my specific problem but more complex problems from others as well.
We could start by adding an alb.ingress.kubernetes.io/IamRoleArnToAssume
annotation
in the TargetGroupBinding
. If that annotation is present, then the aws-load-balancer-controller
would attempt to impersonate it before interacting (using the above IAM permissions) with that specific target group.
Such setup would be flexible enough to allow one aws-load-balancer-controller
to manage all the target groups in the world, as long as there exists the right IAM roles for it to impersonate.
I am speaking with my employer to see if they would consider me (or somebody from my team) writing a pull request for that.
That being said, we are not in the aws-load-balancer-controller
business hence it would be great to know if such a pull request would eventually be merged, so we don't have to maintain a fork in the long term.
Thank you