Automation builds Docker image with microservice and push this image into JFrog Artifactory registry labeled by branch name registry/service-name:branch
. 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:
- rebuild the project and push updated docker image into registry with the same label(branch)
- redeploy the microservice in Kubernetes
- microservice redeployed but with old image
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:
"template": {
"metadata": {
"labels": {
"app": "service-name"
},
"annotations": {
"timestamp": "1588246422"
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).
Is it possible to setup Kubernetes or configure manifest file some how to force Kubernetes pull image on each redeployment?