A Rolling Restart Starts New Pods Before Stopping Old Ones, So Readiness Decides Whether Users Notice

In progress Kubernetes

kubectl rollout restart doesn't restart processes in place. It changes the Deployment's pod template, and the Deployment replaces its pods following its update strategy: with the default RollingUpdate, it starts a new pod and removes an old one only once the new one is Ready. Users see no interruption only when "Ready" really means "able to serve".

What rollout restart Does

kubectl rollout restart deployment <deployment-name> -n <namespace>

The command stamps a kubectl.kubernetes.io/restartedAt annotation on the pod template. Any template change starts a rollout, so new pods are created from the same image and configuration. It works on Deployments, StatefulSets and DaemonSets, not on bare pods, which have no controller to recreate them.

With the defaults, maxSurge: 25% rounds up and maxUnavailable: 25% rounds down. For a single replica that means one extra pod is allowed and none may be unavailable: the new pod starts first, and the old one is terminated once the new one is Ready.

Readiness Is the Gate

Without a readiness probe, a container counts as Ready as soon as it starts. The Service then sends traffic to an application that is still loading, and the old pod is already shutting down. A readiness probe on a real health endpoint makes the rollout wait until the new pod can answer.

Following a Rollout

kubectl rollout status deploy/<app> -n <ns>          # waits until the rollout completes
kubectl logs -n <ns> -l app=<app> --tail=50 -f       # logs by label, not by pod name

Each replacement pod gets a new name and IP (see A Pod Is the Unit Kubernetes Schedules, and Each Pod Gets an IP from the Pod CIDR), so a label selector keeps working across restarts where a copied pod name does not. kubectl rollout undo returns to the previous template if the new pods never become Ready.

References