Skip to main content

Kubernetes deployments can be updated using the rolling update strategy. This will update the deployment in a phased manner, with new pods being created and old pods being deleted in each phase. This ensures that there is no downtime for the application during the update process.

Kubernetes Deployment Rolling Update

The rolling update strategy provides us with high availability. Assume you have five pods operational. When you update the deployment, the rolling update deletes one pod and creates a new pod. This will be repeated for the remaining four pods as well. As a result, the rolling update ensures that the application is always available. There is no time for rest.

To use the rolling update strategy, specify the “–rolling-update” flag when performing the update:

kubectl RollingUpdate MyDep --image=MyNewImage:v1.0.0

The above command will update the “MyDep” deployment to use the “MyNewImage:v1.0.0” image. New pods will be created with this image and old pods will be deleted in a rolling fashion.

The rolling update strategy can be further customized by specifying the “–max-surge” and “–max-unavailable” flags. These flags control how many pods can be created or deleted in each phase of the update process.

For example, the following command will ensure that no more than 25% of the pods are deleted in each phase:

kubectl RollingUpdate MyDep --image=MyNewImage:v1.0.0 --max-surge=25% --max-unavailable=25%

Updates can also be performed on individual objects in a deployment. To do this, use the “kubectl rollout history” command to view the revision history for the deployment:

kubectl rollout history MyDep

This will show you a list of all the revisions that have been made to the deployment. To update an individual object, use the “kubectl rollout undo” command followed by the revision number:

kubectl rollout undo MyDep --to-revision=2

This will roll back the deployment to revision 2. New pods will be created with the old image and any pods using the new image will be deleted.

The rolling update strategy can be used to perform A/B testing on a deployment.

To do this, create two identical deployments with different images. Then, use the “kubectl rollout” commands to update one of the deployments to use the new image. This will cause half of the pods in the deployment to use the new image and half to use the old image. If there are no problems with the new image, then you can roll it out to the other deployment. Otherwise, you can roll back the first deployment to using the old image.

Keep in mind:

There are some things to keep in mind when using this kubernetes deployment strategy. In particular, you need to be careful about how you handle application dependencies. If one of your dependencies is not updated along with your application, it could cause problems.

Another thing to keep in mind is that rolling updates can take some time to complete. If you’re deploying a large application, it might take several minutes or even hours for the update to finish. This can be disruptive to your users, so you need to plan accordingly.

Finally, keep in mind that rolling updates are not always the best kubernetes deployment strategy for every situation. If you’re deploying a critical application, you might want to consider using a different strategy, such as canary deployments.


The kubernetes deployment rolling update strategy is a great way to update your applications with zero downtime. By using this strategy, you can update your application one replica at a time while ensuring that the new replicas are working correctly before continuing.

It is also very simple to revert to the previous deployment. It functions similarly to a checkpoint in the SQL application. We can roll back to a previous version or a specific version of the Deployment.

This provides a consistent, high-quality experience for your users while allowing you to keep your application up-to-date.