Kubernetes update deployment selectively in rolling updates

12/8/2020

I am trying to understand whether Kubernetes redeploys in case of rolling updates if we have same version of docker images.

Suppose in a deployment we have 5 images (applications)

  • and if I want to update only say 1 application and update only that image

will the other applications which is already using the latest version (we can use the pull policy to be "IfNotPresent") be updated/the pods running the latest version of the other apps be rolled out to new pods? or because they are already running the latest images be left as is?

Essentially what I am trying to ask is if we have say 50 applications and we are using kubernetes with helm charts, if we want to update only 1 application and make sure other application pods are not affected at all, what would be the deployment strategy?

-- Subhomoy Sikdar
docker
kubernetes
rolling-updates

1 Answer

12/8/2020

If you use the "latest" tag in combination with Pull Policy "IfNotPresent", K8s will just use whatever Docker images it finds in the local Docker Registry of the worker nodes. This effectively renders the deployment of new version impossible.

To answer your question: there is no way you can permanently update only one Pod of a Deployment. You could do so temporarily by editing one of the Pods directly, but this will be overwritten, once there is a redeployment.

If the configuration needs to be permanent, you could create a separate deployment for applications with the new image. Make sure to use labels in order to get the Service of the application to forward traffic to it as well as the other Deployment.

Also, for deterministic behavior and ability to run different versions of the same application for different deployment, you will have to stop using the "latest" tag.

-- Fritz Duchardt
Source: StackOverflow