Kubernetes AWS NLB Services Create Excessive Amount Of Security Group Rules
Asked Answered
B

1

7

The Kubernetes Service doc shows the below explanation of how Node security groups are updated for each NLB Service.

enter image description here

Unfortunately, I have a VPC that has 3 different CIDRs. This means that for every port on a Service, 4 new rules are added to the Nodes' security group. There is a team that has a NLB Service with 5 ports, which means it results in 20 new rules added to the Nodes' security group. Other teams normally have 2 Ports, which results in 8 rules added to the Nodes' security group. The end result is we sometimes reach the max amount of 64 Rules allowed on one Security Group.

What are ideas to design around this so that teams can create as many NLB Services with as many ports as they want?

Brinkmanship answered 1/10, 2020 at 19:15 Comment(1)
I don't know why someone downvoted my question here given ip based routing was not possible 8 months ago for NLB services.Brinkmanship
I
6

The EKS documentation says something about this.

For each NLB that you create Amazon EKS adds one inbound rule to the node's security group for client traffic and one rule for each load balancer subnet in the VPC for health checks. Deployment of a service of type LoadBalancer can fail if Amazon EKS attempts to create rules that exceed the quota for the maximum number of rules allowed for a security group. For more information, see Security groups in Amazon VPC quotas in the Amazon VPC User Guide. Consider the following options to minimize the chances of exceeding the maximum number of rules for a security group.

  • Request an increase in your rules per security group quota. For more information, see Requesting a quota increase in the Service Quotas User Guide.

  • Use Create a network load balancer, rather than instance targets. With IP targets, rules can potentially be shared for the same target ports. Load balancer subnets can be manually specified with an annotation. For more information, see Annotations on GitHub.

  • Use an Ingress, instead of a Service of type LoadBalancer to send traffic to your service. The AWS Application Load Balancer (ALB) requires fewer rules than NLBs. An ALB can also be shared across multiple Ingresses. For more information, see Application load balancing on Amazon EKS.

  • Deploy your clusters to multiple accounts.

If none of those options work for you, and you have also ALBs, you can minimize the rules for those ALB forcing them to use a specific security group instead of adding their rules to the node's security group. The annotation is service.beta.kubernetes.io/aws-load-balancer-security-groups. Doing so, you replace several rules for just one, leaving more space for NLBs rules.

Ivan answered 17/6, 2021 at 14:20 Comment(2)
This question was asked 8 months ago when IP based routing wasn't an option.Brinkmanship
Sure, I imagined, anyway if anybody missed the documentation it would be helpful. I just added an additional workaround to the list.Ivan

© 2022 - 2024 — McMap. All rights reserved.