<p>I'm using a CI to update my kubernetes cluster whenever there's an update to an image. Whenever the image is pushed and has the latest tag it kubectl apply's the existing deployment but nothing gets updated.</p>
<p>this is what runs
<code>$ kubectl apply --record --filename /tmp/deployment.yaml</code></p>
<p>My goal is when the apply is ran that a rolling deployment gets executed.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
    name: api
spec:
    replicas: 1
    template:
    metadata:
        labels:
        app: api
    spec:
        containers:
        - name: api
        image: us.gcr.io/joule-eed41/api:latest
        imagePullPolicy: Always
        ports:
            - containerPort: 1337
        args:
            - /bin/sh
            - -c
            - echo running api;npm start
        env:        
        - name: NAMESPACE
            valueFrom:
            configMapKeyRef:
                name: config
                key: NAMESPACE
</code></pre>

<p>As @ksholla20 mentionedm using <code>kubectl set image</code> is a good option for many (most?) cases.</p>
<p>But if you can't change the image tag consider using:</p>
<p>1 ) <code>kubectl rollout restart deployment/&lt;name&gt;</code>
(<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-restart-em-" rel="nofollow noreferrer">reference</a>).</p>
<p>2 )  <code>kubectl patch deployment &lt;name&gt; -p &quot;{\&quot;spec\&quot;:{\&quot;template\&quot;:{\&quot;metadata\&quot;:{\&quot;labels\&quot;:{\&quot;version\&quot;:\&quot;$CURRENT_BUILD_HASH_OR_DATE\&quot;}}}}}}&quot;</code> (<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#patch" rel="nofollow noreferrer">reference</a>)</p>
<p>(*) Notice that the <code>patch</code> command allow you to change specific properties in the deployment (or any other object chosen) like the <em>label selector</em> and the <em>pod label</em> or other properties like the value of the <code>NAMESPACE</code> environment variable in your example.</p>
