In Kubernetes, what does the desired replicas count represent compared to the actual replicas count?
Think about what you tell Kubernetes to do versus what it has done so far.
The desired replicas is the number of pod instances you ask Kubernetes to maintain. The actual replicas is how many pods are currently running. Kubernetes tries to match actual to desired.
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
The READY column shows how many pods are ready out of desired.
The READY column shows 3/5, meaning 3 pods are ready and running out of 5 desired replicas.
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?
Look at the pods themselves before making big changes.
Checking pod status helps identify if pods are crashing or stuck, which explains why actual replicas don't match desired.
Which snippet correctly sets the desired replicas to 3 in a Kubernetes deployment YAML?
Replicas is a field under spec, not metadata or template.
The replicas field must be directly under spec to set desired pod count. Other placements are invalid.
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?
Think about what prevents new pods from starting even if desired replicas increased.
If cluster resources like CPU or memory are insufficient, new pods remain Pending and actual replicas stay low.