<p>I have an image pushed to Google Container Registry, named <code>gcr.io/$(PROJECT_ID)/img-name:46d49ab</code>.</p>

<p>In my replication controller I have:</p>

<pre><code>apiVersion: v1
kind: ReplicationController
metadata:
  name: go-server-rc
spec:
  replicas: 3
  selector:
    name: go-server
    version: v8
  template:
    metadata:
      labels:
        name: go-server
        version: v8
    spec:
      containers:
      - name: go-server
        image: gcr.io/$(PROJECT_ID)/img-name:46d49ab
        ports:
        - containerPort: 5000
</code></pre>

<p>This works, but it doesn't when I remove the commit hash tag <code>46d49ab</code>. I don't want to have to change the tag every single time I commit.</p>

<p>I have also set up a trigger on Google Container Builder to pull the master branch of my repository after every commit, and create an image <code>gcr.io/$(PROJECT_ID)/img-name:$(COMMIT_HASH)</code>.</p>

<p>How can I edit my replication controller file to just get the most recent? What workflows do people use?</p>

<p><a href="https://kubernetes.io/docs/concepts/containers/images/#updating-images" rel="nofollow noreferrer">It's possible</a> to use the <code>latest</code> tag to ensure Kubernetes pulls the image each time it runs. Every time you create a new image tag it with <code>latest</code> and push it to the container registry. However, I would not recommend this.</p>

<p>You won't know which pods are running which version of your code. I do exactly as you mention in your question. I find it's better to update your deployment object each time your image updates. This will ensure the deployment is in the state you expect and troubleshooting will be clearer when looking at images.</p>
