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 default
Customize:
Namespace:
Resource Name:

Flags & Parameter Breakdown

deployment/<name>Deployment resource to trigger rolling restart on
-n <namespace>Namespace where deployment resides

Step-by-Step Execution Workflow

1Trigger rolling restart

Initiate the rolling restart without changing configuration:

kubectl rollout restart deployment/my-app -n default
2Watch the rollout progress

Stream live status until all new replica pods are ready:

kubectl rollout status deployment/my-app -n default
3Rollback if errors arise

If the newly spawned pods fail, instantly undo the restart:

kubectl rollout undo deployment/my-app -n default

Common 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.