0

I have a k8s deployment (using helm) that should grab an image from a repo. if I specify the image with exact tag - it will be taken by the k8s. recently - in order not to change the code I've changed the image name to xxx/myserver:latest.

I'm pushing the latest tag to the repo each time I've updating the image: so xxx/myserver:v11 -- >xxx.myserver:latest and then v12 arrives I'm pointing the latest tag to it.

my problem is that once k8s grabbed the latest version (for v11) it will not grab it again and it keeps building the old container.

2

You need to update your image pull policy on your deployment. By default it will only pull images from the repo if the same version is not present in the cluster. As you are using the latest tag, then the Kubernetes does not know that the image has been updated. You need to force it to pull every time using the ImagpullPolicy of Always.

Using "latest" is generally a bad idea in production, as you will not know what version of an image each of your pods is running.

3
  • thanks - there is no way to force pull only if the checksum is changed ? the image is 12 GB, I don't want it to be pulled every time, just when it changes. – Dani Jul 5 '20 at 13:07
  • Nope, the only thing it is looking at is the version. I would recommend you look at pulling a specific version – Sam Cogan Jul 5 '20 at 13:08
  • according to the k8s git team the always does exactly what I need - it will check the hash and not the name. I though that always mean Always pull the image - but if the hash is the same it will not pull (according to their comment on my request) – Dani Jul 6 '20 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.