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
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.
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.
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!
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.
I expect it will indeed pull the new image but still find the previously cached one.
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.
Changing the image tag, name, or repository location usually alters the pod template hash and should trigger a redeployment or update.

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