Toolvito

Works on this device

Container Resource Calculator

Type the CPU and memory requests and limits of each container of a Kubernetes pod. You get the pod totals as the scheduler counts them, the QoS class, and the totals for all replicas. A second part works out how many pods fit on a node and how many nodes you need.

Enter your values

Type the requests and limits of each container as in the manifest (250m, 512Mi). You get the pod totals, the QoS class and the totals for all replicas.

Your values

The totals are worked out for this many pods.

Containers

CPU in cores or millicores, such as 250m or 1. Memory with Mi or Gi, such as 256Mi. Leave a box blank when the manifest does not set it.

More options

Optional. Set by a RuntimeClass with overhead (for example sandboxed runtimes). Leave blank when there is none.

Optional, as above, such as 120Mi.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Choose Requests and limits of a pod, and its QoS class.
  2. Type each container as in the manifest: CPU such as 250m or 1, memory such as 256Mi or 1Gi. Leave a box blank when the manifest does not set it. Mark init containers as such.
  3. Type the number of replicas and choose Calculate.
  4. To see how many of these pods fit on a node, choose Use these requests for pods per node, then type the allocatable CPU and memory of your node.

The rules

  • Defaults: a container with a limit but no request gets a request equal to its limit. A request above the limit is refused by Kubernetes.
  • Init containers run one at a time before the app containers, so only the largest one counts: pod request = the higher of (the sum of the app containers) and (the largest init container), plus the pod overhead of a RuntimeClass if there is one. Limits are found the same way; one app container without a limit leaves the pod without a limit.
  • QoS class: Guaranteed when every container (init containers too) has CPU and memory limits and requests equal to them. BestEffort when no container has any request or limit. Burstable in every other case.
  • Pods per node: the scheduler places a pod when the requests already on the node plus the new pod fit in the allocatable CPU and memory, and the node is below its pod limit. Pods per node = the smallest of free CPU ÷ pod CPU, free memory ÷ pod memory (rounded down), and the pods still allowed.
  • Nodes needed = pods ÷ pods per node, rounded up. Cost = nodes × your price per hour × hours in a month.

Worked example

A pod has two app containers: web (CPU 250m request, 500m limit; memory 256Mi request, 512Mi limit) and log-agent (50m, 100m; 64Mi, 128Mi), and one init container migrate (500m, 1; 128Mi, 256Mi). The app containers need 300m of CPU, but the init container needs 500m, so the pod CPU request is 500m. Memory: 256Mi + 64Mi = 320Mi, more than the 128Mi of the init container. The limits are 1 CPU and 640Mi. Requests are below limits, so the QoS class is Burstable. Three replicas request 1500m of CPU and 960Mi of memory.

A node with 3920m CPU and 13Gi memory allocatable already runs pods that request 650m and 1Gi. Free: 3270m and 12Gi. Pods with requests of 500m and 512Mi: 3270 ÷ 500 = 6.54, so 6 by CPU, and 12,288 ÷ 512 = 24 by memory. So 6 fit, limited by CPU, and 10 pods need 2 nodes. At an example price of 0.20 per node-hour and 730 hours, that is 292.00 a month, or 29.20 per pod.

Limits you should know

  • Node sizes and prices are yours to type. The example values are for trying the tool; they are not the size or the price of any provider's machine.
  • The page does not know your LimitRanges, ResourceQuotas or admission rules, which can change requests and limits.
  • Pods per node counts requests only. Spreading rules, anti-affinity, taints, volumes and ports can keep a pod off a node. Leave room for rolling updates and for nodes that fail.
  • Sidecar containers (Kubernetes 1.29 and later) should be entered as app containers; their effect on the init phase is not modelled.

Related tools