Cloud and Container Basics

resources:
  requests:
    cpu: 500m
  limits:
    cpu: 1000m

In a Deployment whose Pod containers have the settings above, four Pods are running, each using 400m (0.4 cores) of CPU. The HorizontalPodAutoscaler's target CPU utilization is 60%, and the required number of Pods is computed as ⌈current number × current utilization ÷ target utilization⌉. Which of the following is the required number of Pods?

  1. A3
  2. B5
  3. C6
Show answer and explanation

Answer: C. 6

The CPU utilization used by a HorizontalPodAutoscaler is a percentage of requests, not of limits. Each Pod uses 400m ÷ 500m = 80%, so the required number is 4 × 80 ÷ 60 = 5.33…, which rounds up to 6. With 6 Pods, the total usage of 400m × 4 = 1,600m is shared at about 267m each, a utilization of about 53%, below the target. If requests are not set, autoscaling based on CPU utilization does not work.

  • A. This uses the 40% utilization relative to the limit (1000m) (4 × 40 ÷ 60 = 2.67…, rounded up). Utilization is based on requests.
  • B. This rounds 5.33… down. With 5 Pods each would use 1,600m ÷ 5 = 320m, a utilization of 64%, above the 60% target.
  • C. Correct. With 80% utilization, 4 × 80 ÷ 60 = 5.33… rounds up to 6.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. In Kubernetes, which of the following correctly describes the resource requests and limits set for a container?
  2. 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?
  3. A managed database service in the cloud (one in which the provider operates the database software) is used. Under the shared responsibility model, which of the following generally remains the user's responsibility?
  4. In the cloud, which of the following is the main purpose of placing web servers and database replicas across several availability zones within the same region?
  5. With serverless functions (FaaS), only the first call to a function that has not been called for a while sometimes responds hundreds of milliseconds to several seconds slower. Which of the following correctly explains this phenomenon?