Skip to content

kubectl rollout status: timed out waiting for the condition

Kubernetestested on kind v0.33.0, Kubernetes v1.37.0

rollout status waits until all new pods are ready. If one never comes up, the command ends after --timeout with “timed out waiting for the condition” and exit 1. The application usually keeps running – on the old version.

Symptom

kubectl rollout status deploy/api --timeout 30s; echo "Exit: $?"
Waiting for deployment "api" rollout to finish: 1 out of 3 new replicas have been upd…
error: timed out waiting for the condition
Exit: 1

In the course a version that does not exist (notes-api:0.3.0) is rolled out on purpose. Exit 1 means: not finished – exactly what a pipeline checks.

Diagnosis

Look at the deployment first, then the pods – which pod is stuck, and why?

kubectl get deploy api
NAME   READY   UP-TO-DATE   AVAILABLE   AGE
api    3/3     1            3           3m
kubectl get pods
NAME                   READY   STATUS         RESTARTS   AGE
api-6768975f45-nfpvf   0/1     ErrImagePull   0          31s
api-9cb44cd5b-8wq98    1/1     Running        0          43s
api-9cb44cd5b-g9qfn    1/1     Running        0          40s
api-9cb44cd5b-twrzx    1/1     Running        0          45s

Causes

ErrImagePullThe new pod does not come up

Here the image does not exist. A failing readiness probe, a missing ConfigMap key or a missing ServiceAccount stall the rollout in the same way.

maxUnavailable 0The deployment removes no old pod

With maxUnavailable 0 no old pod may go before a new one is ready. That is why the application stays reachable at 3/3. After progressDeadlineSeconds (default 600 s) the deployment reports ProgressDeadlineExceeded but does not roll back by itself.

Fix

Remove the cause – or roll back to the previous revision and check that the cluster matches the file again.
kubectl rollout undo deploy/api
deployment.apps/api rolled back
kubectl rollout status deploy/api
deployment "api" successfully rolled out
kubectl diff -f k8s/api.yaml; echo "diff-Exit: $?"
diff-Exit: 0

Don't: Deleting the old pods to “push” the rollout. Then the application goes down, because no new pod is ready.

▶
Break it yourself and find it – free
Kubernetes hands-on, Day 2: a deployment with three replicas, self-healing, a rollout without downtime and a rollback.
Go to day 2 →

FAQ

Does Kubernetes roll back a stuck rollout by itself?

No. After progressDeadlineSeconds the deployment only reports ProgressDeadlineExceeded; you roll back yourself.

How do I use this in a pipeline?

Call kubectl rollout status with --timeout and check the exit code – 1 means not finished.

Related error patterns

More