What does the term 'desired replicas' mean in Kubernetes?
Desired replicas refer to the number of pod instances you want running for a specific application or service, as defined in the deployment configuration.
Click to reveal answer
beginner
What are 'actual replicas' in Kubernetes?
Actual replicas are the number of pod instances currently running in the cluster for a deployment or replica set.
Click to reveal answer
intermediate
How does Kubernetes ensure the actual replicas match the desired replicas?
Kubernetes uses a controller that constantly monitors the actual replicas and creates or deletes pods to match the desired replicas automatically.
Click to reveal answer
beginner
What command shows the desired and actual replicas of a deployment?
The command kubectl get deployment <deployment-name> shows desired replicas in the 'READY' column (e.g., 3/3) and actual available replicas under 'AVAILABLE'.
Click to reveal answer
intermediate
What might cause the actual replicas to be less than the desired replicas?
Possible causes include insufficient resources, pod startup failures, or node issues preventing pods from running.
Click to reveal answer
In Kubernetes, what does the 'desired replicas' number represent?
AThe number of pods currently running
BThe number of containers per pod
CThe number of nodes in the cluster
DThe number of pods you want running
✗ Incorrect
Desired replicas are the number of pod instances you want running as set in the deployment.
Which Kubernetes component adjusts pods to match desired replicas?
AController Manager
Bkubectl
CAPI Server
DScheduler
✗ Incorrect
The Controller Manager monitors and adjusts pods to match the desired replicas.
What kubectl command shows the desired and actual replicas of a deployment?
Akubectl get pods
Bkubectl describe node
Ckubectl get deployment <name>
Dkubectl logs <pod>
✗ Incorrect
kubectl get deployment shows desired and actual replicas.
If actual replicas are less than desired replicas, what could be a reason?
AToo many nodes available
BPod startup failures
Ckubectl is not installed
DDeployment is paused
✗ Incorrect
Pod startup failures can cause fewer actual replicas than desired.
What does Kubernetes do if actual replicas exceed desired replicas?
ADeletes extra pods to match desired replicas
BCreates more pods
CDoes nothing
DRestarts the cluster
✗ Incorrect
Kubernetes deletes extra pods to keep actual replicas equal to desired replicas.
Explain the difference between desired replicas and actual replicas in Kubernetes.
Think about what you want vs what you have running.
You got /3 concepts.
Describe what happens when the actual replicas do not match the desired replicas in a Kubernetes deployment.
Consider Kubernetes as a system that fixes differences automatically.
You got /3 concepts.
Practice
(1/5)
1. What does the desired replicas value represent in a Kubernetes Deployment?
easy
A. The number of pods currently running
B. The number of containers inside a pod
C. The number of nodes in the cluster
D. The number of pod copies Kubernetes should run
Solution
Step 1: Understand the role of desired replicas
Desired replicas specify how many copies of a pod Kubernetes should maintain to run your app.
Step 2: Differentiate from actual replicas
Actual replicas show how many pods are currently running, which may differ temporarily.
Final Answer:
The number of pod copies Kubernetes should run -> Option D
Quick Check:
Desired replicas = target pod count [OK]
Hint: Desired replicas = target pods Kubernetes tries to run [OK]
Common Mistakes:
Confusing desired replicas with actual running pods
Thinking desired replicas count containers, not pods
Mixing desired replicas with cluster node count
2. Which of the following is the correct YAML snippet to set desired replicas to 3 in a Deployment?
easy
A. replicaCount: 3
B. desiredReplicas: 3
C. replicas: 3
D. pods: 3
Solution
Step 1: Identify the correct field name in Deployment spec
The correct field to set desired replicas is replicas under the spec section.
Step 2: Verify syntax correctness
Using replicas: 3 is valid YAML and recognized by Kubernetes.
Final Answer:
replicas: 3 -> Option C
Quick Check:
Use 'replicas' to set desired pod count [OK]
Hint: Use 'replicas' key in Deployment spec to set desired pods [OK]
Common Mistakes:
Using incorrect field names like desiredReplicas or replicaCount
Placing replicas outside the spec section
Using plural 'pods' instead of 'replicas'
3. You run kubectl get deployment myapp and see: DESIRED=4, CURRENT=3, UP-TO-DATE=3, AVAILABLE=3 What does this mean?
medium
A. One pod has crashed and won't restart
B. Kubernetes is still creating the 4th pod
C. All pods are running as expected
D. Deployment is scaled down to 3 pods
Solution
Step 1: Compare desired and current replicas
Desired is 4 but current is 3, so Kubernetes aims for 4 pods but only 3 are running now.
Step 2: Interpret the status fields
Up-to-date and available are 3, meaning 3 pods are ready and updated; the 4th pod is likely starting.
Final Answer:
Kubernetes is still creating the 4th pod -> Option B
Quick Check:
Desired > Current means pods are still launching [OK]
Hint: Desired > Current means pods are starting or recovering [OK]
Common Mistakes:
Assuming pods crashed without checking events
Thinking deployment scaled down when desired is higher
Confusing available with desired replicas
4. You notice your Deployment's desired replicas is 5 but actual replicas stays at 3. Which is the most likely cause?
medium
A. Pods are stuck in Pending state due to resource limits
B. Deployment YAML has syntax errors
C. kubectl command was typed incorrectly
D. Actual replicas always match desired replicas instantly
Solution
Step 1: Understand why actual replicas lag behind desired
If actual replicas are less than desired, pods may be stuck starting, often due to resource constraints.
Step 2: Eliminate other options
Syntax errors prevent deployment creation, incorrect kubectl commands won't show this state, and actual replicas do not update instantly.
Final Answer:
Pods are stuck in Pending state due to resource limits -> Option A
Quick Check:
Pending pods cause actual < desired replicas [OK]
Hint: Check pod status if actual replicas < desired replicas [OK]
Common Mistakes:
Assuming syntax errors cause replica mismatch
Expecting instant replica count update
Ignoring pod scheduling issues
5. You want to ensure your Deployment always has 3 pods running. You set replicas: 3 but sometimes kubectl get pods shows only 2 running pods. What should you do to fix this?
hard
A. Check pod events and logs to find why one pod is not running and fix the issue
B. Increase replicas to 4 to force Kubernetes to create more pods
C. Delete the Deployment and recreate it with replicas set to 3
D. Ignore it; actual replicas will eventually match desired without intervention
Solution
Step 1: Investigate why pods are missing
Check pod events and logs to identify issues like crashes, scheduling failures, or resource limits causing pods not to run.
Step 2: Fix the root cause
Resolve the identified problem (e.g., fix image, increase resources) so Kubernetes can maintain 3 running pods as desired.
Final Answer:
Check pod events and logs to find why one pod is not running and fix the issue -> Option A
Quick Check:
Fix pod issues to match actual to desired replicas [OK]
Hint: Always check pod status and logs if replicas don't match [OK]
Common Mistakes:
Scaling replicas blindly without fixing pod issues
Deleting Deployment unnecessarily
Assuming Kubernetes fixes pod issues automatically
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.