Automated Kubernetes rolling update when the same tag is pushed to a container registry Automated Kubernetes rolling update when the same tag is pushed to a container registry kubernetes kubernetes

Automated Kubernetes rolling update when the same tag is pushed to a container registry


Yes, it's possible. If ACR can call a webhook whenever a new image is pushed (even with the same tag), you can call a webhook service in your cluster. The service can then, for example, update an annotation in the PodTemplateSpec of your Deployment, which triggers a rolling update of your Pods.

However, it requires that the imagePullPolicy of the containers is set to Always, as the tag of the image remains unchanged. Otherwise, Kubernetes would think that it's still the same image and would use the one that it has previously pulled.

For access to the Kubernetes API, you can do this with a ServiceAccount to which you assign the necessary Kubernetes API permissions with Roles and RoleBindings. Finally, you assign this ServiceAccount to your Pods through the serviceAccountName field in the PodSpec.