kubectl rollout status

Show the status of a rollout. Watches the deployment progress and reports whether it completed successfully.

kubectl rollout status [TYPE] [NAME] [flags]

Common Flags

FlagShortDescription
--watch-wWatch the status until the rollout completes (default true)
--timeoutThe length of time to wait before giving up (default 0, wait forever)
--namespace-nNamespace of the resource
--revisionPin to a specific revision for showing the status

Examples

Watch the rollout status of a deployment

kubectl rollout status deployment/my-app

Wait for rollout with a timeout

kubectl rollout status deployment/my-app --timeout=300s

Check status without watching

kubectl rollout status deployment/my-app --watch=false

Check rollout of a DaemonSet

kubectl rollout status daemonset/fluentd -n kube-system

Check rollout of a StatefulSet

kubectl rollout status statefulset/postgresql

When to Use kubectl rollout status

kubectl rollout status monitors the progress of a rolling update. It watches the deployment until all new pods are ready and the old pods are terminated, then reports the result. This is essential in CI/CD pipelines where you need to know whether a deployment succeeded before proceeding.

Monitoring Rollouts

The basic usage watches the rollout in real-time:

# Watch rollout progress
kubectl rollout status deployment/my-app
# Waiting for deployment "my-app" rollout to finish: 2 of 3 updated replicas are available...
# deployment "my-app" successfully rolled out

# Check a DaemonSet rollout
kubectl rollout status daemonset/node-exporter -n monitoring

# Check a StatefulSet rollout
kubectl rollout status statefulset/elasticsearch -n logging

The output shows the progress as pods are updated and becomes ready. When all replicas are updated and available, it prints a success message and exits with code 0.

CI/CD Pipeline Integration

The exit code behavior makes rollout status ideal for automation:

# Deploy and verify
kubectl apply -f deployment.yaml
if ! kubectl rollout status deployment/my-app --timeout=300s; then
  echo "Deployment failed, rolling back"
  kubectl rollout undo deployment/my-app
  exit 1
fi
echo "Deployment successful"

# Full pipeline script
kubectl set image deployment/my-app app=myapp:${BUILD_TAG}
kubectl rollout status deployment/my-app --timeout=600s
RESULT=$?
if [ $RESULT -ne 0 ]; then
  echo "Rollout failed. Current status:"
  kubectl describe deployment my-app
  kubectl rollout undo deployment/my-app
  kubectl rollout status deployment/my-app --timeout=120s
  exit 1
fi

Timeout Configuration

Always set a timeout in automated environments:

# 5-minute timeout
kubectl rollout status deployment/my-app --timeout=300s

# 10-minute timeout for large deployments
kubectl rollout status deployment/my-app --timeout=600s

# Quick check without watching
kubectl rollout status deployment/my-app --watch=false

Without --timeout, the command waits indefinitely. If the rollout is stuck due to image pull errors, failing readiness probes, or resource constraints, your pipeline will hang.

Understanding Rollout States

A rollout progresses through several states:

# In progress
# Waiting for deployment "my-app" rollout to finish: 1 of 3 updated replicas are available...

# Complete
# deployment "my-app" successfully rolled out

# Stalled (progressDeadlineSeconds exceeded)
# error: deployment "my-app" exceeded its progress deadline

The progress deadline (default 600 seconds) determines how long Kubernetes waits for the rollout to make progress before marking it as failed. You can configure this in the deployment spec:

spec:
  progressDeadlineSeconds: 300

Combining with Other Commands

Use rollout status as part of a broader monitoring workflow:

# Apply, watch, and verify
kubectl apply -f deployment.yaml
kubectl rollout status deployment/my-app --timeout=300s

# Check the resulting pods
kubectl get pods -l app=my-app

# Verify the new image is running
kubectl get deployment my-app -o jsonpath='{.spec.template.spec.containers[0].image}'

Debugging Failed Rollouts

When rollout status reports a failure, investigate:

# Check deployment conditions
kubectl describe deployment my-app | grep -A 10 "Conditions"

# Check for pod issues
kubectl get pods -l app=my-app
kubectl describe pod <failing-pod-name>

# Check events
kubectl get events --sort-by=.lastTimestamp -n <namespace>

# Check the latest ReplicaSet
kubectl get rs -l app=my-app --sort-by=.metadata.creationTimestamp
kubectl describe rs <latest-replicaset>

Best Practices

Always use --timeout in scripts and CI/CD pipelines. Monitor rollout status after any change that triggers a rollout (apply, set image, patch, edit). Pair rollout status with rollout undo for automated rollback on failure. Set appropriate progressDeadlineSeconds in your deployment spec to match your application's startup time.

Interview Questions About This Command

How do you verify that a deployment rollout completed successfully in a CI/CD pipeline?
Use kubectl rollout status deployment/<name> --timeout=300s. The command exits with code 0 on success and non-zero on failure or timeout, making it suitable for pipeline scripts.
What resource types support rollout commands?
Deployments, DaemonSets, and StatefulSets support rollout commands. These are the resource types that manage rolling updates through pod template changes.

Common Mistakes

  • Not using --timeout in CI/CD pipelines, causing the pipeline to hang indefinitely if the rollout stalls.
  • Assuming a successful rollout status means the application is healthy. The rollout only checks pod readiness, not application-level health.
  • Not checking rollout status after kubectl set image or kubectl apply, missing failed rollouts.

Related Commands