<p>I'm using <code>kubectl apply</code> to update my Kubernetes pods:</p>

<pre><code>kubectl apply -f /my-app/service.yaml
kubectl apply -f /my-app/deployment.yaml
</code></pre>

<p>Below is my service.yaml:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-app
  labels:
    run: my-app
spec:
  type: NodePort
  selector:
    run: my-app 
  ports:
  - protocol: TCP
    port: 9000
    nodePort: 30769
</code></pre>

<p>Below is my deployment.yaml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:  
  selector:
    matchLabels:
      run: my-app
  replicas: 2
  template:
    metadata:
      labels:
        run: my-app
    spec:
      containers:
      - name: my-app
        image: dockerhubaccount/my-app-img:latest
        ports:
        - containerPort: 9000
          protocol: TCP
      imagePullSecrets:
      - name: my-app-img-credentials
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
</code></pre>

<p>This works fine the first time, but on subsequent runs, my pods are not getting updated.</p>

<p>I have read the suggested workaround at <a href="https://github.com/kubernetes/kubernetes/issues/33664" rel="noreferrer">https://github.com/kubernetes/kubernetes/issues/33664</a> which is:</p>

<pre><code>kubectl patch deployment my-app -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
</code></pre>

<p>I was able to run the above command, but it did not resolve the issue for me.</p>

<p>I know that I can trigger pod updates by manually changing the image tag from "latest" to another tag, but I want to make sure I get the latest image without having to check Docker Hub.</p>

<p>Any help would be greatly appreciated.</p>

Floating Sunfish
<p>If nothing changes in the deployment spec, the pods will not be updated for you. This is one of many reasons it is not recommended to use <code>:latest</code>, as the other answer went into more detail on. The <code>Deployment</code> controller is very simple and pretty much just does <code>DeepEquals(old.Spec.Template, new.Spec.Template)</code>, so you need some actual change, such as you have with the PATCH call by setting a label with the current datetime.</p>
