We have a system that currently uses docker-compose
for deployment of containers (effectively docker-compose pull && docker-compose up
) and are in the process of converting the system to Kubernetes.
We have CI/CD that deploys to production automatically based on git tags pushed to the git repository. For staging, we keeping advancing a branch. The docker images are built and tagged with either the git production tag or git staging branch name.
At deployment, docker-compose
is intelligent enough to not restart the container if the image is actually the same, i.e. two production tags point to the same image.
I'm looking for a way to do the same thing in Kubernetes - if at deployment the actual image used for the container of the pod is the same as what's already running (based on the image checksum, not just the image tag), then it shouldn't have to restart the pod. Is this possible?
Thanks
As I mentioned in comments, it should work out of the box with
imagePullPolicy:Always
.According to documentation
Also there is a tool called imago, worth to take a look on it. Imago checks running pods sha256 and just restart resource that need to use newer images.