title: Kubernetes deployment rolling update with semantic container names
body: <p>I want to use a Kubernetes <a href="http://kubernetes.io/docs/user-guide/deployments/#updating-a-deployment" rel="nofollow">deployment</a> and reference container images with semantic tag names. E.g. <code>application:latest</code>, <code>application:testing</code>, <code>application:production</code>.</p>
  
  <p>Setting this up is straight forward and with the <code>imagePullPolicy: Always</code> within my container spec I can also push out new versions quickly with something like this:</p>
  
  <pre><code> $ REPLICAS=$(kubectl get deployment application --template="{{.spec.replicas}}")
   $ kubectl scale --replicas=0 deployment application
   deployment "application" scaled
   $ kubectl scale --replicas=$REPLICAS deployment application
   deployment "application" scaled
  </code></pre>
  
  <p>The drawback is that all pods are killed before the new ones are ready. Therefore I'm looking to get rolling updates going.</p>
  
  <p>One solution would be to drop the semantic tag names and use sth. like <code>application:v123</code>. But I'd love to keep my scripts simple and keep the semantic names. Is there any way to do that?</p>
  
  <p>...</p>
  
  <p>Edit/update ... this is what my <code>deployment.yaml</code> configuration would look like:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
   kind: Deployment
   metadata:
     name: nginx-deployment
   spec:
     replicas: 3
     template:
       metadata:
         labels:
           app: application
       spec:
         containers:
         - name: application
           image: application:latest
           imagePullPolicy: Always
  </code></pre>
  
  <p>It would basically stay the same all the time, but the related container image is updated in the background.</p>
  
  <p>...</p>
  
  <p>Cheers</p>