kuberneteskubectlrollout

Does "kubectl rollout restart deploy" cause downtime?


I'm trying to get all the deployments of a namespace to be restarted for implementation reasons.

I'm using "kubectl rollout -n restart deploy" and it works perfectly, but I'm not sure it that command causes downtime or if it works as the "rollout update", applying the restart one by one, keeping my services up.

Does anyone know?

In the documentation I can only find this:

Operation Syntax Description
rollout kubectl rollout SUBCOMMAND [options] Manage the rollout of a resource. Valid resource types include: deployments, daemonsets and statefulsets.

But I can't find details about the specific "rollout restart deploy".

I need to make sure it doesn't cause downtime. Right now is very hard to tell, because the restart process is very quick.

Update: I know that for one specific deployment (kubectl rollout restart deployment/name), it works as expected and doesn't cause downtime, but I need to apply it to all the namespace (without specifying the deployment) and that's the case I'm not sure about.


Solution

  • kubectl rollout restart deploy -n namespace1 will restart all deployments in specified namespace with zero downtime.

    Restart command will work as follows:

    1. After restart it will create new pods for a each deployments
    2. Once new pods are up (running and ready) it will terminate old pods

    Add readiness probes to your deployments to configure initial delays.