Kubectl Rollout — Restart, Status, and Undo
Essential kubectl rollout commands for deployments: restart, status checks, history, and rollback.
# Trigger a rolling restart (without config change)
kubectl rollout restart deployment/api-server -n production
# Watch rollout status
kubectl rollout status deployment/api-server -n production
# View rollout history
kubectl rollout history deployment/api-server
# View details of a specific revision
kubectl rollout history deployment/api-server --revision=3
# Rollback to previous version
kubectl rollout undo deployment/api-server
# Rollback to a specific revision
kubectl rollout undo deployment/api-server --to-revision=2
# Pause a rollout (for canary-style verification)
kubectl rollout pause deployment/api-server
# Resume a paused rollout
kubectl rollout resume deployment/api-server
# Scale deployment
kubectl scale deployment/api-server --replicas=5
# Update image (triggers rolling update)
kubectl set image deployment/api-server \
api=registry.example.com/api-server:1.3.0
# Quick checks during rollout
kubectl get pods -l app=api-server -w # watch pods
kubectl describe deployment api-server | grep -A5 Conditions
kubectl top pods -l app=api-server # resource usageSponsored
DigitalOcean
Use Cases
- Zero-downtime deployment restarts
- Quick rollback when a new release has bugs
- Canary deployments with pause/resume
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
Kubernetes Deployment Manifest
Production-ready Kubernetes deployment with resource limits, probes, rolling updates, and anti-affinity.
Best for: Deploying containerized applications to Kubernetes
Kubernetes HPA — Horizontal Pod Autoscaler
Configure horizontal pod autoscaling based on CPU, memory, and custom metrics for Kubernetes workloads.
Best for: Auto-scaling APIs based on traffic load
Kubernetes ConfigMap and Secret Management
Create and use ConfigMaps and Secrets for application configuration with env vars and volume mounts.
Best for: Managing application configuration in Kubernetes
Kubernetes CronJob — Scheduled Tasks
Create Kubernetes CronJobs for scheduled tasks with history limits, concurrency control, and deadlines.
Best for: Scheduling daily data exports or reports