Helm upgrade doesn't pull new container Helm upgrade doesn't pull new container kubernetes kubernetes

Helm upgrade doesn't pull new container


Helm will roll out changes to kubernetes objects only if there are changes to roll out. If you use :latest there is no change to be applied to the deployment file, ergo no pods will rolling update. To keep using latest, you need to add something (ie. label with sha / version) that will change and cause deployment to get updated by helm. Also keep in mind that you will usualy need ImagePullPolicy: Always as well.


The way I solved this in the deployment script in .gitlab.yaml, you can do similar in any of your deployment scripts.

export SAME_SHA=$(helm get values service-name | grep SHA | wc -l)if [ SAME_SHA -eq 1] then helm uninstall service-name; fihelm upgrade --install service-name -f service-values.yml .

This may not be the best approach for production as you may end up uninstall a live service, but for me, production sha are never the same so this works.