kubectl rollout status: Command Reference for CI/CD
The canonical CI gate: wait for a deploy, fail on a bad one.
kubectl rollout status blocks until a rollout finishes or its progress deadline is exceeded, returning non-zero on failure. That exit code is what makes it the ideal deploy gate. This reference covers its flags and how to bound it.
Common flags and usage
- rollout status deploy/<name>: block until the rollout completes
- --timeout=120s: cap the wait, then exit non-zero
- --watch=false: report current status once and return
- --revision=N: check a specific revision rolled out
- Works on Deployments, StatefulSets, and DaemonSets
Example
shell
kubectl set image deploy/web web=web:${IMAGE_TAG}
kubectl rollout status deploy/web --timeout=180s || {
kubectl rollout undo deploy/web
exit 1
}In CI
Place rollout status immediately after any change that triggers a rollout (apply, set image, helm upgrade). It exits non-zero on "exceeded its progress deadline" which correctly fails the pipeline. Always pass --timeout so the step fails fast instead of hanging until the job-level timeout.
Key takeaways
- rollout status exits non-zero on a failed rollout: the gate you want.
- Always pass --timeout so CI fails fast, not at the job ceiling.
- Pair a failed gate with rollout undo to auto-restore service.
Related guides
kubectl Cheat Sheet: Commands for Everyday KubernetesA kubectl cheat sheet - get, describe, logs, apply, rollout, debug, and context commands for daily Kubernetes…
kubectl rollout undo: Command Reference for CI/CDReference for kubectl rollout undo: roll a Deployment back to a previous revision, with rollout history, chan…
kubectl set image: Command Reference for CI/CDReference for kubectl set image: promote a Deployment to a new image tag in one command, why immutable tags m…
kubectl wait: Command Reference for CI/CDReference for kubectl wait: block on a condition (Ready, Available, complete, delete) with a timeout, the rig…