Answers: <p>The main problem here is, that from a Kubernetes point-of-view nothing has changed to your deployment. So nothing gets updated.</p>
  
  <p>The best solution here would be, that you add something to your image tag, like the git short hash, for example. The your update will just work. Also you will make your deployments re-creatable, when you do it this way.</p>
  
  <p>If you really want to keep it the way it is, you could add some other information to the deployment, that changes on each deployment, but is not used, like an annotation. But I would not recommend that, since I saw this leading to strange behavior with <em>old</em> pods no being shutdown.</p>
  
  <p>On a side note: The <code>imagePullPolicy</code> is just evaluated, when there <em>is</em> change to your deployment. So basically this flag says: If you do deploy something (e.g. bc there is a new deployment), no matter if you have the image already locally, reload it from the registry.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-08-01T11:56:34.337Z
Answers: That makes sense and I think adding the short git hash is a good solution to the problem. I've accepted your answer.
Answers: Caledonia91
Answers: CC BY-SA 4.0
Answers: 2018-08-01T11:12:36.743Z
Answers: 2018-08-01T11:12:36.743Z
Answers: Max N.
Body: <p>During development we are continually building a Docker image with the same version (say 0.0.1-development) as there is no need to bump for each minor change. We do eventually bump when additional features are added.</p>
  
  <p>We've discovered that <code>kubectl set image deployment/ourdeployment</code> doesn't force the updated container to be pulled from Dockerhub and run if the version in the image hasn't changed.</p>
  
  <p>In the deployment we have <code>imagePullPolicy: Always</code> but this doens't seem to have any effect.</p>
  
  <p>Is there a way we can achieve the desried behaviour of pulling down the image even if the version hasn't bumped, replacing the old containers each time?</p>
  
Tags: <docker><kubernetes><deployment>
Title: How to update pods if version hasn't changed?
UserDisplayName: Caledonia91
ThreadText: # How to update pods if version hasn't changed?
  
  (Asked by: username_0 on 2018-08-01)
  
  During development we are continually building a Docker image with the same version (say 0.0.1-development) as there is no need to bump for each minor change. We do eventually bump when additional features are added.
  
  We've discovered that `kubectl set image deployment/ourdeployment` doesn't force the updated container to be pulled from Dockerhub and run if the version in the image hasn't changed.
  
  In the deployment we have `imagePullPolicy: Always` but this doens't seem to have any effect.
  
  Is there a way we can achieve the desried behaviour of pulling down the image even if the version hasn't bumped, replacing the old containers each time?
  
  **Tags:** docker, kubernetes, deployment
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-01. Score: 1 | Accepted answer
  
  The main problem here is, that from a Kubernetes point-of-view nothing has changed to your deployment. So nothing gets updated.
  
  The best solution here would be, that you add something to your image tag, like the git short hash, for example. The your update will just work. Also you will make your deployments re-creatable, when you do it this way.
  
  If you really want to keep it the way it is, you could add some other information to the deployment, that changes on each deployment, but is not used, like an annotation. But I would not recommend that, since I saw this leading to strange behavior with *old* pods no being shutdown.
  
  On a side note: The `imagePullPolicy` is just evaluated, when there *is* change to your deployment. So basically this flag says: If you do deploy something (e.g. bc there is a new deployment), no matter if you have the image already locally, reload it from the registry.
  
  > **Comments:**
  > **username_0**: That makes sense and I think adding the short git hash is a good solution to the problem. I've accepted your answer.  
  
  ---
  
  