Sub topic 10
Deployment and ReplicaSet status and rollouts
This chapter assumes you can read Pod status and conditions and run kubectl get and kubectl describe. It shows how Pod-level problems appear one level up, on the Deployment and its ReplicaSets.
How a Deployment reports status
A Deployment does not run Pods directly. It creates a ReplicaSet for each version of its Pod template, and each ReplicaSet creates the Pods. Each controller writes its own status, so you can read progress at three levels.
kubectl get deployment webThe output has three count columns.
| Column | Meaning |
|---|---|
| READY | Ready Pods out of the desired replica count |
| UP-TO-DATE | Pods created from the newest Pod template |
| AVAILABLE | Ready Pods that have stayed ready for at least `minReadySeconds` |
During a rolling update, UP-TO-DATE rises while AVAILABLE changes more slowly. A rollout is complete when every replica is up to date and available.
Deployment conditions
Deployments report conditions in the same type/status/reason form as Pods. The two you will see most are Available and Progressing.
kubectl rollout status deployment/web
kubectl get deployment web -o jsonpath='{.status.conditions[*].type}'The first command waits and reports progress until the rollout finishes. It exits with a non-zero code if the rollout fails, so it works in CI scripts. The second lists the condition types.
AvailableisTruewhen enough Pods are available, as set by the rolling update'smaxUnavailablesetting.ProgressingisTruewhile a rollout is making progress or after it completes. Its reason isNewReplicaSetAvailablewhen the rollout has finished.ProgressingbecomesFalsewith reasonProgressDeadlineExceededwhen no progress happens forprogressDeadlineSeconds(600 by default).
The Deployment does not roll back when the deadline passes. It only reports the failure, and the controller keeps trying. You decide whether to fix the template or run kubectl rollout undo.
Following a rollout through ReplicaSets
kubectl get replicaset -l app=web
kubectl describe deployment webA healthy rolling update shows the new ReplicaSet growing while the old one shrinks. The Deployment's Events section records each scaling step, for example "Scaled up replica set web-7d9f to 1". The ReplicaSet's own events record Pod creation and any failure to create Pods, such as a quota error.
kubectl get replicaset -l app=webReading a stalled rollout
Work down the ownership chain.
- Run
kubectl rollout status deployment/web. A message such as "Waiting for deployment rollout to finish: 1 out of 3 new replicas have been updated" confirms the stall. - Run
kubectl get replicasetand find the ReplicaSet with the newest age. Its READY count is lower than DESIRED. - Run
kubectl get podsand find Pods from that ReplicaSet. Their names start with the ReplicaSet name. - Describe one of those Pods and read its container state and events, as in the earlier chapters.
The old ReplicaSet usually keeps serving traffic during the stall, because maxUnavailable limits how many old Pods the controller may remove. This is why a bad rollout often causes no outage, only a Deployment that never completes.
Common mistakes
- Checking only READY. A Deployment can show
3/3while it is still replacing Pods, so also check UP-TO-DATE. - Treating
ProgressDeadlineExceededas a rollback. Nothing is undone automatically. - Describing the Deployment when the cause is in a Pod. The Deployment's events say only that Pods were created, not why they fail.
Exercise
A Deployment shows READY 3/3 and UP-TO-DATE 1 after you changed the image. Is the rollout finished? What do you check next?
Show answer
No. Only one Pod comes from the new template, so the rollout is still in progress or has stalled. Run kubectl rollout status deployment/web, then compare the READY and DESIRED counts of the old and new ReplicaSets. If the new one is stuck, describe its Pods and read their events.
Exercise
Which condition and reason show that a rollout has stalled past its deadline, and what does Kubernetes do about it?
Show answer
The Progressing condition becomes False with reason ProgressDeadlineExceeded. Kubernetes only reports it. It does not roll back, so you fix the template or run kubectl rollout undo.