- Newest
- Most votes
- Most comments
When using Security Groups for Pods in Amazon EKS, there is indeed a discrepancy between the standard maxPods calculation and the actual pod capacity of a node. This occurs because pods using security groups are associated with branch interfaces that are not accounted for in the traditional maxPods formula.
The standard formula for calculating maxPods is: (Number of network interfaces for the instance type * (the number of IP addresses per network interface - 1)) + 2
However, when Security Groups for Pods is enabled, branch interface capacity is additive to existing instance type limits for secondary IP addresses. This means pods that use security groups are not counted against the max-pods value calculated by the standard formula.
When using Karpenter as your cluster autoscaler with Security Groups for Pods, you should configure the karpenter-global-settings configmap with aws.reservedENIs set to 1. This reserves one ENI for the trunk interface that manages the branch ENIs.
While this configuration ensures Karpenter won't allocate the trunk ENI for regular pod IP assignments, it does mean that the maxPods calculation will be lower than the actual capacity of the node. This is because the standard formula doesn't account for the additional capacity provided by branch interfaces.
Currently, there isn't an automatic way to make Karpenter aware of the additional capacity provided by branch interfaces. You have two options:
-
Manually increase the max-pods value in your Karpenter configuration to account for the additional capacity. You can specify this through kubelet-extra-args.
-
Accept that nodes may be underutilized according to the standard calculation, but in reality, they can accommodate more pods than the calculation suggests.
If you choose to manually increase the max-pods value, you should carefully consider the actual capacity of your instance types, taking into account both CPU and memory resources. For example, on smaller instance types like m5.large, you might exhaust CPU and memory resources before IP addresses, so setting an artificially high max-pods value could lead to resource contention.
Sources
Security Groups Per Pod - Amazon EKS
Amazon VPC CNI - Amazon EKS
Troubleshooting Amazon EKS networking issues at scale in an Enterprise scenario | AWS re:Post
answered a year ago
Relevant content
asked 8 months ago
