Cloud and Container Basics
A node has allocatable resources of 4 CPU cores and 8 GiB of memory. Each Pod's container has requests of 500m CPU and 1.5 GiB memory and limits of 1 CPU core and 2 GiB memory. There are no other Pods and no system reservations. Which of the following is the maximum number of Pods that can be placed on this node?
- A4
- B5
- C8
Show answer and explanation
Answer: B. 5
The scheduler places Pods so that the sum of the requests of the Pods on a node does not exceed the allocatable amount, for CPU and for memory separately. CPU allows up to 4000m ÷ 500m = 8 Pods, but memory allows 8 ÷ 1.5 = 5.33…, that is, up to 5. Both conditions must hold, so the answer is 5. Limits are not used for placement, so the limits of the 5 Pods add up to 5 CPU cores and 10 GiB of memory, more than the node has, and resources run short if all Pods use their maximum at the same time.
- A. This is the value computed from limits (CPU 4 ÷ 1 = 4, memory 8 ÷ 2 = 4). Placement is decided by requests.
- B. Correct. CPU allows 8 Pods and memory 5, so the smaller number, 5, applies.
- C. This uses only the CPU requests. The total memory requests must also fit within 8 GiB.