Cloud and Container Basics
A Kubernetes HorizontalPodAutoscaler has a target CPU utilization of 70% and a range of 1 to 10 Pods. Currently the average CPU utilization of 5 Pods is 30%. When the required number of Pods is computed as ⌈current number × current utilization ÷ target utilization⌉ (⌈ ⌉ means rounding up), which of the following is the required number of Pods?
- A2
- B3
- C12
Show answer and explanation
Answer: B. 3
A HorizontalPodAutoscaler determines the number of Pods as required number = ⌈current number × current utilization ÷ target utilization⌉. 5 × 30 ÷ 70 = 2.14…, which rounds up to 3. The same formula reduces the number when load falls (scale-in), and the result is kept within the specified range (1 to 10). In practice, a tolerance band leaves the number unchanged when the utilization ratio is close to 1, and a waiting period observes the load for a while before scaling in, so the number of Pods does not change too often.
- A. This rounds 2.14… down. With 2 Pods the utilization per Pod would be 30 × 5 ÷ 2 = 75%, above the 70% target, so the value is rounded up.
- B. Correct. 5 × 30 ÷ 70 = 2.14…, rounded up to 3.
- C. This swaps the target and current utilization (5 × 70 ÷ 30 = 11.7…, rounded up). The utilization is below the target, so the number of Pods goes down.