We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Rollouts

When you change a deployment's pod template (the image, the environment variables, anything under spec.template), Kubernetes doesn't kill all the old pods at once. It does a rolling update:

  1. It creates a new ReplicaSet for the new version of the pods.

  2. It scales the new ReplicaSet up a pod or two at a time.

  3. It scales the old ReplicaSet down as the new pods become ready.

As long as the new pods come up healthy, users shouldn't notice anything because there are always at least some healthy pods serving traffic. Each new version of the template is a numbered revision. The kubectl rollout command manages this process:

  • kubectl rollout status deployment NAME: Watch a rollout until it finishes

  • kubectl rollout history deployment NAME: List the revisions

  • kubectl rollout restart deployment NAME: Replace every pod with a fresh one, without changing the config

Now, the restart command might sound pointless... but you'll probably use it fairly often. It's the "turn it off and on again" of Kubernetes.

In order for rollouts to be truly seamless for your users, you also need to make sure that old pods finish handling requests in progress before they're shut down, and that new pods are fully ready before they start handling requests.

Assignment

Submit the shell checks.