How to set Kubernetes image pull retry limit How to set Kubernetes image pull retry limit kubernetes kubernetes

How to set Kubernetes image pull retry limit


AKAIK, the only way to control this as of this writing is with the imagePullPolicy in the container spec.

You may set it to Never but your pod will not run since the image is not present locally. Or you can set it to IfNotPresent but somehow you will have to have to create an image with that specific tag locally in your K8s nodes. Either option is not ideal, but I believe there might be a rationale to have it go into ImagePullBackOff: people would want to to know why their pod is not running.

So IMO the bigger question is why would you want to delete/invalidate images in your docker registry that are still running in your cluster? Why not update the pods/deployments/daemonsets/replicasets/statefulsets with the latest images prior to deleting or invalidating an image in the docker registry (also called deploy)?

The general practice could be something like this:

create new image => deploy it => make sure everything is ok => {  ok => invalidate the old image tag.  not ok => rollback => delete new image tag => go back to create new image => create new image tag.}

Note, layers, and images are not deleted in a docker registry. You can delete or overwrite tags: How to delete images from a private docker registry?