Will changing an image repository trigger a redeployment in Kubernetes?

0
29
Asked By CuriousCoder99 On

I'm working with a StatefulSet for Redis and RabbitMQ using the Bitnami Helm charts, and I have the "imagePullPolicy" set to "IfNotPresent". I'm considering changing the repository URL from Bitnami to Bitnami Archive, even though the actual image content (like the MD5 hash) remains exactly the same. I'm wondering if Kubernetes will recognize that there's no change and keep using the cached image, or if changing the repository will force a new pull and cause a rollout of new application pods.

5 Answers

Answered By K8S_Enthusiast On

I doubt there’s any intelligence on this from Kubernetes. I’d say a rollout will be triggered, but the container runtime will probably reuse the previous image cache.

Answered By ByteWhisperer On

I was looking into a similar situation where CI changed image URLs from a local registry to GitLab’s. The good news is, images with the same digest don’t get downloaded again, but that doesn’t prevent a rollout from happening.

DataDynamo55 -

So even if it skips the download (thanks to the container runtime), it still triggers a Kubernetes rollout, right?

Answered By TechSeeker42 On

I think the repository name is part of the image name, so changing it will likely trigger a redeployment. Testing it in a lab environment is definitely faster than writing out all the details!

CodeNinja88 -

Yeah, I have a lab setup too, but since the switch is already made and the previous image isn't available anymore, I can't just go back to test this out.

DevGuru03 -

I expect it will indeed pull the new image but still find the previously cached one.

Answered By StatefulSensei On

If the spec.template changes, it will definitely cause a rollout because it changes the SHA of the replicaset. I've found that setting an onDelete strategy for a StatefulSet can help avoid this issue.

Answered By CloudWizard76 On

Changing the image tag, name, or repository location usually alters the pod template hash and should trigger a redeployment or update.

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.