<p><strong>Background:</strong></p>

<p>We're currently using a continuous delivery pipeline and at the end of the pipeline we deploy the generated Docker image to some server(s) together with the latest application configuration (set as environment variables when starting the Docker container). The continuous delivery build number is used as version for the Docker image and it's currently also this version that gets deployed to the server(s). </p>

<p>Sometimes though we need to update the application configuration (environment variables) and reuse an existing Docker image. Today we simply deploy an existing Docker image with an updated configuration.</p>

<p>Now we're thinking of switching to Kubernetes instead of our home-built solution. Thus it would be nice for us if the version number generated by our continuous delivery pipeline is reflected as the pod version in Kubernetes as well (even if we deploy the same version of the Docker image that is currently deployed but with different environment variables).</p>

<p><strong>Question:</strong></p>

<p>I've read the documentation of <a href="https://cloud.google.com/container-engine/docs/kubectl/rolling-update?hl=en" rel="nofollow">rolling-update</a> but it doesn't indicate that you can do a rolling-update and <em>only</em> change the environment variables associated with a pod without changing its version. </p>

<ol>
<li>Is this possible? </li>
<li>Is there a workaround?</li>
<li>Is this something we should avoid altogether and use a different approach that is more "Kubernetes friendly"?</li>
</ol>

<p>Rolling update just scales down one replicationController and scales up another one.  Therefore, it deletes the old pods and make new pods, at a controlled rate.  So, if the new replication controller json file has different env vars and the same image, then the new pods will have that too.  </p>

<p>In fact, even if you don't change anything in the json file, except one label value (you have to change some label), then you will get new pods with the same image and env.  I guess you could use this to do a rolling restart?</p>

<p>You get to pick what label(s) you want to change when you do a rolling update.  There is no formal Kubernetes notion of a "version".  You can make a label called "version" if you want, or "contdelivver" or whatever.</p>

<p>I think if I were in your shoes, I would look at two options:</p>

<p>Option 1: put (at least) two labels on the rcs, one for the docker image version (which, IIUC is also a continuous delivery version), and one for the "environment version".  This could be a git commit, if you store your environment vars in git, or something more casual.  So, your pods could have labels like "imgver=1.3,envver=a34b87", or something like that.</p>

<p>Option 2: store the current best known replication controller, as a json (or yaml) file in version control (git, svn, whatevs).  Then use the revision number from version control as a single label (e.g. "version=r346").  This is not the same as your continuous delivery label.
It is a label for the whole configuration of the pod.</p>
