Rolling updates on Kubernetes

Kubernetes is one of the most widely used container orchestration tool at present.

In the earlier post, I have explained how to deploy your spring boot application on Kubernetes cluster.

In this post, we will see how we can instruct Kubernetes to start a rolling update so that we can release a new version of our application without any downtime.

$ kubectl set image deployments/hostping hostping=pulgupta/hostping:latest


Lets breakdown this command. For more details on each construct of this command please see this post

  • deployment/hostping: This is the name of our deployment
  • pulgupta/hostping:latest: This is the new image which we want to use for our application

There is a lot of stuff going on behind the scene when we execute this command. Let us see what will Kubernetes do when this command is issued.

  • It will fetch the latest tag of the image pulgupta/hostping
  • It will start a new pod for the new image
  • Once a new pod is available it will stop an old pod so that the total number of pods are equal to the number specified in the replica set
  • Kubernetes will repeat this process until we have replaced all the old pods with the new pods.
  • This all is done in a step by step process and hence we will have zero downtime for our application during this complete upgrade.


Leave a comment