Will Changing My Image Repository URL Force a Redeployment in Kubernetes?

0
8
Asked By CuriousCoder92 On

I'm working with a StatefulSet setup for Redis and RabbitMQ using Bitnami's Helm charts, and I've set the imagePullPolicy to 'IfNotPresent'. I want to change the repository from Bitnami to Bitnami Archive, but the image content will remain the same (the MD5/hash is unchanged). Will Kubernetes recognize that there's no real change and keep the current image from the cache, or will it trigger a new image pull and force a redeployment of my application pods?

5 Answers

Answered By DevOpsNinja On

Changing the image tag, name, or repository definitely affects the pod template hash, which will trigger a redeployment or update in Kubernetes.

Answered By CloudExplorer On

I found a workaround to avoid rollouts when CI changes image URLs from a local registry to GitLab’s. The good part is that Docker/containerd won’t download images with the same digest again, but that might not prevent Kubernetes from rolling out new pods.

NewbieQuestion -

So, if it won't redownload due to the same digest, will Kubernetes still force a rollout?

Answered By StatefulSupport On

If it changes the spec.template, it’ll definitely cause a rollout since that alters the hash of the ReplicaSet. The only way I found to manage this is to set an onDelete strategy for the StatefulSet.

Answered By K8SGuru On

I doubt Kubernetes has the intelligence to avoid a rollout in this case. I think it will trigger a redeploy, but you might find the container runtime using the cached image.

Answered By TechieDan On

It seems like changing the repository name would be seen as a change, so it likely will trigger a redeployment. That's why it's a good idea to test in a lab environment first—it’s often quicker than asking for help!

LabRat123 -

I have a lab set up too, but this switch has already happened for me. The image is gone from the original repo, so I can't easily flip back to check how Kubernetes reacts.

CautiousDev -

I’d expect it to redownload, but luckily, everything should still be cached if the image is unchanged.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.