Pod limit on Node - AWS EKS
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Pod Limit on Node in AWS EKS
AWS Elastic Kubernetes Service (EKS) provides a managed Kubernetes solution that allows users to run Kubernetes without having to install and manage their own control plane or nodes. One of the key considerations when managing workloads in EKS is understanding the limitations of pods on nodes. These limitations are crucial for ensuring efficient resource allocation, cost management, and optimal cluster performance.
Understanding Pod Limits
In Kubernetes, a "Pod" is the smallest deployable unit consisting of one or more containers. The pod limit on a node is determined by several factors, including the instance type of the node, the amount of resources allocated to the kubelet, and inherent Kubernetes configurations.
Technical Background
In EKS, each Kubernetes cluster node is an AWS EC2 instance. Kubernetes relies on `kubelet` to manage pods on each node. `kubelet` has a configuration limit that dictates how many pods can be scheduled onto the node. This is known as the "maxPods" parameter and is influenced by the instance’s compute and memory resources.
Here's a breakdown of essential factors influencing pod limits:
- Instance Type: The type of EC2 instance used as a node determines available CPU and memory resources, dictating the maxPod value. Larger instances usually accommodate more pods.
- Network Interface (ENI) Limitation: Each instance type has a maximum number of Elastic Network Interfaces (ENIs) and IP addresses per ENI. Kubernetes assigns one IP per pod, meaning the ENI limits also cap the number of pods per node.
- Kubelet Configuration: The "maxPods" parameter sets an upper bound on pods per node. This is configurable, but it should be set within reasonable limits to avoid resource contention.
Default Behavior in EKS
AWS EKS provides default configurations aligning with best practices. Here is a simplified example of how "maxPods" might be set based on instance type:
| Instance Type | Max ENIs | IPs per ENI | Max Pods |
| t3.small | 3 | 4 | 11 |
| m5.large | 3 | 10 | 29 |
| c5.2xlarge | 4 | 58 | 234 |
| r4.8xlarge | 8 | 30 | 235 |
Configuring Pod Limits
Modifying maxPods
While EKS sets a default maxPods value, there may be scenarios requiring a different configuration:
- To Change maxPods: Update maxPods by altering the `kubelet` settings on the instance. This can be done via user data scripts when launching an instance or configuring it through the EKS cluster creation scripts. Ensure that new limits are within practical compute limits.
Considerations for Custom Node AMIs
Using a custom AMI requires careful management of the maxPods setting, as these AMIs may not adhere to the default configuration. It's essential to manually calculate the maxPods based on the following formula:
For many AMIs, the reserved IP count is usually set to 1.
Monitoring and Troubleshooting
Efficient monitoring of pod limits and node resources is crucial. AWS provides CloudWatch for logging and monitoring. Insights into the following metrics should be maintained:
- Node Resource Utilization: Track CPU, memory, and network utilization to prevent bottlenecks.
- Pod Allocation and Density: Regularly check the number of pods scheduled per node versus the configured maxPods.
- Alerting: Set alerts for reaching near-threshold resource usage.
Conclusion
The pod limit on a node in AWS EKS is a critical factor affecting Kubernetes cluster performance and efficiency. Understanding and configuring the maxPods parameter while taking into account the instance type and network limitations is essential for optimal operations. Proper monitoring and resource management ensure that your workloads are effectively hosted in a scalable and cost-efficient manner.
By following best practices and adjusting configurations to suit specific workload requirements, EKS users can maximize the robust scalability features that AWS and Kubernetes inherently offer.
Related reading
- Pod not terminating
- Pod receives traffic even Kubernetes readiness probe fails
- Pod Security Policy not working as intended
- pod shows existing but get pod not found error when running port-forward
- Pod template for specifying tolerations when running Spark on Kubernetes
- Possible reasons for timeout when trying to access EC2 instance
- Pod status as CreateContainerConfigError in Minikube cluster
- Pods-resources.sh Permission denied in iOS Project

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.