Best-effort controlled rollout – Managing Advanced Kubernetes Resources

Best-effort controlled rollout helps you roll out your deployment on a best-effort basis, and you can use it to roll out your release faster and ensure that your application is available. It can also help with applications that do not tolerate more than a certain number of replicas at a given point.

We will set maxSurge to 0 and maxUnavailable to any percentage we find suitable for remaining unavailable at a given time to implement this. It can be specified using the number of pods or as a percentage.

Tip

Using a percentage is a better option since, with this, you don’t have to recalculate your maxUnavailable parameter if the replicas change.

Let’s look at the manifest—nginx-best-effort-controlled-rollout.yaml:

spec:

replicas: 10

strategy:

type: RollingUpdate

rollingUpdate:

maxSurge: 0

maxUnavailable: 25%

Let’s now apply the YAML file and see what we get:

$ kubectl apply -f nginx-best-effort-controlled-rollout.yaml \

  • kubectl get replicaset -w deployment.apps/nginx configured
NAMEDESIREDCURRENTREADYAGE
nginx-6799fc88d820020m
nginx-6889dfccd588816m
nginx-6799fc88d822120m
nginx-6889dfccd578816m
…………….  
nginx-6889dfccd511116m
nginx-6799fc88d899820m
nginx-6889dfccd501116m
nginx-6799fc88d8109820m
nginx-6889dfccd500016m
nginx-6799fc88d810101020m

So, we see the ReplicaSet resource rolling out such that the total pods are at most 10 at any point, and the total unavailable pods are never more than 25%. You may also notice that instead of creating a new ReplicaSet resource, the Deployment resource uses an old ReplicaSet resource containing the nginx:latest image. Remember when I said the old ReplicaSet resource is not deleted when you update a Deployment resource?

Deployment resources on their own are great ways of scheduling and managing pods. However, we have overlooked an essential part of running containers in Kubernetes—exposing them to the internal or external world. Kubernetes provides several resources to help expose your workloads appropriately— primarily, Service and Ingress resources. Let’s have a look at these in the next section.

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 *