Kubernetes Deployment Rollout Stalled by an Unavailable Pod
Diagnose and safely recover a Kubernetes Deployment rollout that cannot reach its required available replica count.
Destructive Operation
This intervention contains destructive operations. Proceed with extreme caution and ensure database backups exist before execution.
01 // Diagnose
Symptom
A Deployment rollout remains incomplete and the available replica count stays below the desired count.
Detection Signature
-
Run
kubectl rollout status deployment/api -n production --timeout=60sand record the timeout. -
Run
kubectl get deployment api -n production -o wideand compare desired, updated, ready, and available replicas. -
Run
kubectl get pods -n production -l app=api -o wideto identify the new unavailable Pod. -
Run
kubectl describe pod <POD_NAME> -n productionand inspect readiness probe failures and recent events. -
Run
kubectl logs <POD_NAME> -n production --all-containers --tail=200and record application errors without changing the Pod.
Root Cause Analysis
-
A new Pod is failing its readiness probe, so the Pod does not become Ready and the Deployment cannot reach its required available replica count.
-
During the rolling update, the Deployment cannot complete scaling the new ReplicaSet while the new Pod remains unavailable.
02 // Contain & Prevent
Blast Radius
New application instances are unavailable.
The previous ReplicaSet may carry the remaining production load.
Undoing the rollout changes the active Pod template and can cause a temporary availability dip if the previous revision is unhealthy or lacks capacity.
Prevention Measures
-
Test readiness probes against the release candidate before deployment.
-
Alert on Deployment unavailable replicas and rollout duration.
-
Keep revision history sufficient for a controlled rollback.
03 // Fix & Intervention
Pre-Flight Checks
-
Confirm the current namespace and cluster context with
kubectl config current-context. -
Confirm the operator is authorised with
kubectl auth can-i patch deployments.apps -n production; stop if the result is not yes. -
Capture the Deployment and ReplicaSet state with
kubectl get deployment,rs -n production -l app=api -o yaml. -
Run
kubectl rollout history deployment/api -n productionto identify the immediately previous revision. Cross-check that revision's image digests and release identifier against the approved deployment pipeline record; do not infer approval from rollout history alone. -
Confirm the previous ReplicaSet still exists, its image digest is available, and the cluster has enough schedulable capacity for the required replicas.
-
Preview the API-server mutation with
kubectl rollout undo deployment/api -n production --dry-run=server -o yamland verify the resulting Pod template matches the approved previous revision. -
Confirm availability and error-rate monitoring is live, record abort thresholds, and obtain incident commander approval for the production state change.
Execution CommandsCOMMANDS
kubectl rollout undo deployment/api -n production
kubectl rollout status deployment/api -n production --timeout=5m
04 // Verify & Recover
Verification Steps
-
Verify
kubectl rollout status deployment/api -n production --timeout=5msucceeds. -
Confirm desired and available replicas match with
kubectl get deployment api -n production. -
Observe application availability and error rate for at least 15 minutes and confirm both remain at the healthy baseline.
Rollback Protocol
-
If this runbook's rollout-undo action worsens service health: 1.
-
If the undo rollout is still progressing, pause further progress with
kubectl rollout pause deployment/api -n production -
if it has completed, do not rely on pause as a recovery action.
-
Restore the captured pre-flight Deployment specification through the approved deployment pipeline.
-
Resume only through the deployment pipeline after the incident commander confirms the restored specification.
-
Re-run rollout status and availability checks against the restored revision.
Escalation
-
No known-good ReplicaSet exists.
-
Available replicas remain below desired after rollback.
-
Error rate remains above the established healthy baseline for 15 minutes.
Authoritative Sources
Deployments
Deployment rollout, availability, and revision behaviour.
kubectl rollout undo
The supported command for rolling back a resource rollout.
Configure Liveness, Readiness and Startup Probes
Readiness probe failures remove a Pod from matching Service endpoints and keep the container running for recovery.