Bird
0
0

Given this Horizontal Pod Autoscaler configuration:

medium📝 Analysis Q13 of 15
Microservices - Orchestration with Kubernetes
Given this Horizontal Pod Autoscaler configuration:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: api-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api-server
  minReplicas: 2
  maxReplicas: 6
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 60

If the current CPU usage is 90% and there are 3 pods running, how many pods will the autoscaler try to set?
A5 pods
B3 pods
C6 pods
D4 pods
Step-by-Step Solution
Solution:
  1. Step 1: Understand scaling formula based on CPU utilization

    Desired replicas = current replicas * (current CPU / target CPU) = 3 * (90/60) = 4.5
  2. Step 2: Round up and check min/max limits

    4.5 rounds up to 5, which is between minReplicas 2 and maxReplicas 6, so 5 pods will be set.
  3. Final Answer:

    5 pods -> Option A
  4. Quick Check:

    3 * (90/60) = 4.5 -> 5 pods [OK]
Quick Trick: Multiply current pods by (current CPU ÷ target CPU) [OK]
Common Mistakes:
MISTAKES
  • Rounding down instead of up
  • Ignoring min/max replica limits
  • Using target CPU as current CPU

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes