Practical guide
Kubernetes requests, limits, and pod capacity
Calculate total Kubernetes CPU and memory requests, then estimate pod capacity without confusing scheduler requests with limits.
Updated
Kubernetes schedules a Pod according to its resource requests. Limits constrain consumption after scheduling, so adding limits instead of requests does not tell you how many Pods fit on a node.
Resource formulas
For identical replicas, total CPU request equals replicas multiplied by CPU request per Pod. The same multiplication applies to memory requests and limits. Kubernetes CPU 250m means 250 millicores, or 0.25 CPU. 1,024 MiB equals 1 GiB.
Worked example
Twelve replicas at 250m CPU and 256 MiB per Pod request 3,000m, or 3 CPU, and 3,072 MiB total. If their limits are 500m and 512 MiB, aggregate limits are 6 CPU and 6,144 MiB; those limit totals do not replace scheduler-request math.
Use the Kubernetes resource calculator for replica totals. Use the pod capacity calculator to compare requests with allocatable node resources and a reserve. For cloud cost, continue to the EKS cost calculator or GKE cost calculator.
For a standalone Docker host without Kubernetes scheduling semantics, use the Docker memory calculator to reserve host memory and model explicit allocation overcommit.
Capacity edge cases
The smallest of CPU capacity, memory capacity, and the node Pod limit sets the arithmetic maximum. Production capacity may be lower because of DaemonSets, topology constraints, ephemeral storage, IP-address limits, disruption budgets, and failure headroom. Measure real workloads instead of treating limits as observed usage.
Official sources
- https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
- https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/