0
0
Kubernetesdevops~20 mins

Desired replicas vs actual replicas in Kubernetes - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Replica Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Desired vs Actual Replicas in Kubernetes

In Kubernetes, what does the desired replicas count represent compared to the actual replicas count?

ADesired replicas is the number of pods the user wants running; actual replicas is the number currently running.
BDesired replicas is the number of pods currently running; actual replicas is the number the user wants running.
CDesired replicas and actual replicas always have the same value and mean the same thing.
DDesired replicas is the number of nodes in the cluster; actual replicas is the number of pods running.
Attempts:
2 left
💡 Hint

Think about what you tell Kubernetes to do versus what it has done so far.

💻 Command Output
intermediate
1:30remaining
Interpreting kubectl get deployment Output

Given the output below from kubectl get deployment myapp, what is the actual number of pods running?

NAME    READY   UP-TO-DATE   AVAILABLE   AGE
myapp   3/5     5            3           10m
A3 pods are desired but 5 are running.
B5 pods are running and ready.
C3 pods are running and ready.
D5 pods are available but only 3 are up-to-date.
Attempts:
2 left
💡 Hint

The READY column shows how many pods are ready out of desired.

🔀 Workflow
advanced
2:00remaining
Troubleshooting Replica Mismatch in Deployment

You notice your Kubernetes deployment's desired replicas is 4 but actual replicas is stuck at 2. Which step should you take first to diagnose the issue?

ACheck pod status with <code>kubectl get pods</code> to see if pods are failing or pending.
BDelete the deployment and recreate it immediately.
CScale the deployment to 10 replicas to force new pods.
DRestart the Kubernetes cluster to reset pod states.
Attempts:
2 left
💡 Hint

Look at the pods themselves before making big changes.

Configuration
advanced
2:00remaining
Correcting Replica Count in Deployment YAML

Which snippet correctly sets the desired replicas to 3 in a Kubernetes deployment YAML?

A
metadata:
  replicas: 3
spec:
  template:
    metadata:
      labels:
        app: myapp
B
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: myapp
C
spec:
  template:
    replicas: 3
    metadata:
      labels:
        app: myapp
D
replicas: 3
spec:
  template:
    metadata:
      labels:
        app: myapp
Attempts:
2 left
💡 Hint

Replicas is a field under spec, not metadata or template.

Troubleshoot
expert
2:30remaining
Diagnosing Replica Count Not Scaling Up

You updated your deployment to increase replicas from 2 to 5, but kubectl get deployment still shows 2 actual replicas after 10 minutes. What is the most likely cause?

AThe container image tag is incorrect causing pods to crash immediately.
BThe deployment YAML file was not saved before applying changes.
CThe Kubernetes API server is down and not processing requests.
DPods are stuck in Pending state due to insufficient cluster resources.
Attempts:
2 left
💡 Hint

Think about what prevents new pods from starting even if desired replicas increased.