I'm working with StatefulSets for Redis and RabbitMQ using the Bitnami helm charts and I have set the "imagePullPolicy" to "IfNotPresent". I'm planning to change the repository URL from Bitnami to Bitnami Archive; both have the exact same image content with matching MD5/hashes. I'm wondering if Kubernetes will recognize that there's no change and keep the current image cache and StatefulSet running, or if this change will trigger a new image pull and force a rollout of new application pods.
4 Answers
From what I explored, changing the image URLs in CI from a local registry to GitLab's one doesn't always trigger a download of the images again if they have the same digest. However, be aware that it might still kick off a Kubernetes rollout even if no new downloads happen.
Changing the spec.template will definitely cause a rollout since it changes the SHA of the replicaset. The only workaround I've found for StatefulSets is to set an onDelete strategy to avoid that behavior.
Honestly, I doubt Kubernetes has that kind of intelligence. From my experience, I think a rollout will occur, but the container runtime should reuse the cached image if available.
Any change to the image tag, name, or repository location typically changes the pod template hash, which I would expect to trigger a redeployment or update.

So it seems like there won't be a redownload, but is it confirmed that Kubernetes will trigger a rollout? That's a bit concerning.