Kubernetes β’ Deployments & Workloads
How to Restart a Kubernetes Deployment with Zero Downtime
`kubectl rollout restart` injects a new restart timestamp annotation (`kubectl.kubernetes.io/restartedAt`) into the Deployment PodTemplateSpec. This triggers a standard rolling update: new pods start and pass readiness probes before old pods receive SIGTERM.
Restart Deployment Zero Downtime Command
Safe β’ Read-Only / Non-Destructive
kubectl rollout restart deployment/my-app -n defaultCustomize:
Namespace:
Resource Name:
Flags & Parameter Breakdown
deployment/<name>Deployment resource to trigger rolling restart on-n <namespace>Namespace where deployment residesStep-by-Step Execution Workflow
1Trigger rolling restart
Initiate the rolling restart without changing configuration:
kubectl rollout restart deployment/my-app -n default2Watch the rollout progress
Stream live status until all new replica pods are ready:
kubectl rollout status deployment/my-app -n default3Rollback if errors arise
If the newly spawned pods fail, instantly undo the restart:
kubectl rollout undo deployment/my-app -n defaultCommon Pitfalls & Troubleshooting Advice
- Ensure `readinessProbe` is configured so traffic is not routed to starting pods prematurely.
- If you updated a ConfigMap or Secret mounted as environment variables, running `rollout restart` will reload the new values.
Prerequisites & Cluster Access
- Deployment must have replicas >= 2 for zero downtime.
- Deployment must define working readinessProbe checks.
Frequently Asked Questions About Restart Deployment Zero Downtime
Frequently Asked Questions
Frequently Asked Questions
Everything you need to know regarding specifications, syntax, and security best practices.
No, provided your deployment uses the default RollingUpdate strategy with maxSurge/maxUnavailable and has working readiness probes.
Related Kubernetes & DevOps Recipes
View All RecipesNetworking & Access
How to Port-Forward a Kubernetes Pod or Service to Localhost
port-forwardGuide β
Debug & Inspection
How to Exec into a Kubernetes Pod with an Interactive Bash Shell
execGuide β
Troubleshooting
How to Debug and Fix CrashLoopBackOff Pods in Kubernetes
logsGuide β
Troubleshooting
How to Force Delete a Kubernetes Pod Stuck in Terminating State
deleteGuide β
Monitoring & Resources
How to Check CPU and Memory Resource Usage of Pods and Nodes
topGuide β
Config & Secrets
How to Create a Kubernetes Generic Secret from an .env File
createGuide β