<p>Automation builds Docker image with microservice and push this image into JFrog Artifactory registry labeled by branch name <code>registry/service-name:branch</code>. At the next step it applies Kubernetes yaml manifest file and application starts after pulling image at the appropriate Kubernetes node.
The problem is following - when I push changes in microservice source code into repository the automation starts:</p>

<ul>
<li>rebuild the project and push updated docker image into registry with the same label(branch)</li>
<li>redeploy the microservice in Kubernetes</li>
<li>microservice redeployed but with old image</li>
</ul>

<p>I guess it is occurs because there are no changes in 'Deployment' section of Kubernetes yaml manifest file and Kubernetes not pull updated image from JFrog registry. As workaround, I implement inserting timestamp annotation into template section on each redeployment:</p>

<pre><code>  "template": {
      "metadata": {
          "labels": {
              "app": "service-name"
          },
          "annotations": {
              "timestamp": "1588246422"
</code></pre>

<p>But miracle is not happened - image updated only when I delete Kubernetes deployment and redeploy the application (may be in this case it just starts at the another node and docker pull is necessary).</p>

<p>Is it possible to setup Kubernetes or configure manifest file some how to force Kubernetes pull image on each redeployment? </p>

Kirill
<p>I would suggest labeling the images in the pattern of <code>registry/service-name:branch-git-sha</code> or <code>registry/service-name:git-sha</code> which will pull the images automatically.</p>

<p>Or as a workaround, you can keep the current image labeling system and add an <strong>environment variable in the template which gets sets to the timestamp</strong>.</p>

<p>Changing the environment variable will always result in the restarting of the pods along with the config <code>imagePullPolicy: Always</code>.</p>
