Ramped slow rollout – Managing Advanced Kubernetes Resources

If you have numerous replicas but want to roll out the release slowly, observe the application for any issues, and roll back your deployment if needed, you should use this strategy.

Let’s create an nginx deployment, nginx-ramped-slow-rollout.yaml, using the ramped slow rollout strategy:

spec:

replicas: 10

strategy:

type: RollingUpdate

rollingUpdate:

maxSurge: 1

maxUnavailable: 0

The manifest is very similar to the generic Deployment, except that it contains 10 replicas and a strategy section.

The strategy section contains the following:

  • type: RollingUpdate
  • rollingUpdate: The section describing rolling update attributes –maxSurge and maxUnavailable

Now, let’s apply the YAML file and wait for the deployment to completely roll out to 10 replicas using the following commands:

$ kubectl apply -f nginx-ramped-slow-rollout.yaml \

  • kubectl rollout status deployment nginx deployment.apps/nginx configured

deployment “nginx” successfully rolled out

As we see, the pods have rolled out completely. Let’s now update the Deployment resource with a different nginx image version and see what we get using the following command:

$ kubectl set image deployment nginx nginx=nginx:1.16.1 \

  • kubectl get replicaset -w deployment.apps/nginx image updated
NAMEDESIREDCURRENTREADYAGE
nginx-6799fc88d81010103m51s
nginx-6889dfccd51100s
nginx-6799fc88d8910104m
………. .. .. .  
nginx-6889dfccd588847s
nginx-6799fc88d82334m38s
nginx-6889dfccd599847s
nginx-6799fc88d82224m38s
nginx-6889dfccd599951s
nginx-6889dfccd5109951s
nginx-6799fc88d81224m42s
nginx-6889dfccd510101055s
nginx-6799fc88d80114m46s
nginx-6799fc88d80004m46s

So, we see two ReplicaSet resources here—nginx-6799fc88d8 and nginx-6889dfccd5. While the nginx-6799fc88d8 pod is slowly rolling down from 10 pods to 0, one at a time, simultaneously, the nginx-6889dfccd5 pod is slowly rolling up from 0 pods to 10. At any given time, the number of pods never exceeds 11. That is because maxSurge is set to 1, and maxUnavailable is 0. This is a slow rollout in action.

Tip

Ramped slow rollout is useful when we want to be cautious before we impact many users, but this strategy is extremely slow and may only suit some applications.

Let’s look at the best-effort controlled rollout strategy for a faster rollout without compromising application availability.

Related Posts

Static provisioning – Managing Advanced Kubernetes Resources-2

As the Service resource is created, we can create a StatefulSet resource that uses the created PersistentVolume and Service resources. The StatefulSet resource manifest, nginx-manual-statefulset.yaml, looks like…

Static provisioning – Managing Advanced Kubernetes Resources-1

Static provisioning is the traditional method of provisioning volumes. It requires someone (typically an administrator) to manually provision a disk and create a PersistentVolume resource using the…

StatefulSet resources – Managing Advanced Kubernetes Resources

StatefulSet resources help manage stateful applications. They are similar to Deployment resources, but unlike a Deployment resource, they also keep track of state and require Volume and…

Managing stateful applications – Managing Advanced Kubernetes Resources

Imagine you’re a librarian in a magical library. You have a bunch of enchanted books that store valuable knowledge. Each book has a unique story and is…

Horizontal Pod autoscaling – Managing Advanced Kubernetes Resources-2

Now, let’s autoscale this deployment. The Deployment resource needs at least 1 pod replica and can have a maximum of 5 pod replicas while maintaining an average…

Horizontal Pod autoscaling – Managing Advanced Kubernetes Resources-1

Imagine you’re the manager of a snack bar at a park. On a sunny day, lots of people come to enjoy the park, and they all want…

Leave a Reply

Your email address will not be published. Required fields are marked *