<p>I'm running a local minikube cluster as of version v1.15.1 with Kubernetes version v1.19.4 and Docker 19.03.13. Local hypervisor is hyperkit.</p>
<p>I'm unable to update the deployment with a new image version from Docker Hub.
I'm using <code>imagePullPolicy: Always</code>.
The Image is clearly updated on Docker Hub. I pulled it locally and ran the image outside the kubernetes cluster to test that.</p>
<p>I tried the following methods to update within the cluster without success:</p>
<ol>
<li>Deleting the pod and letting it be restarted by kubernetes (because the deployment specifies one replica)</li>
<li>Deleting the whole deployment via <code>kubectl delete deployment service-frontend-voting</code></li>
<li>Doing a rolling update via <code>kubectl rollout restart deployment service-frontend-voting</code>, <code>kubectl get pods</code> shows that the pod is only seconds old. But still, old image.</li>
<li>Updating the deployment via  <code>kubectl set image deployment/service-frontend-voting service-frontend-voting=starax/service-frontend-voting:latest</code></li>
<li>Pushing same image to new tag on docker hub and doing steps 1-3 switching <code>:latest</code> to <code>:next</code> and vice versa</li>
<li>Using only <code>:latest</code> or <code>imagePullPolicy: Always</code> in the deployment spec, because apparently Kubernetes should pull the image if either of those are specified.</li>
</ol>
<p>None of that methods have updated the image. What am I missing here?</p>
<p>The application itself is a simple VueJS app. The wanted change is the backend-url. Using environment variables with a production vue-js app is not trivial and therefor skipped here.</p>
<p>Deployment.yaml for reference:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: service-frontend-voting
  labels:
    app: service-frontend-voting
    role: app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service-frontend-voting
  template:
    metadata:
      labels:
        app: service-frontend-voting
    spec:
      containers:
      - name: service-frontend-voting
        image: starax/service-frontend-voting
        ports:
        - containerPort: 8080
        imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: service-frontend-voting-service
spec:
  selector:
    app: service-frontend-voting
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 31112
</code></pre>
<p>Dockerfile</p>
<pre><code>FROM node:lts-alpine

# install simple http server for serving static content
RUN npm install -g http-server

# make the 'app' folder the current working directory
WORKDIR /app

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# build app for production with minification
RUN npm run build

EXPOSE 8080
CMD [ &quot;http-server&quot;, &quot;dist&quot; ]⏎
</code></pre>

Nicolas Klein
<p>If you did pull the image outside the minikube cluster and you successfully run it as docker container .. then It should work(check if the <strong>IMAGE ID</strong> is unique, else if  you didnt change anything in dockerfile then newly created image will have the same image ID ) If successfully created , tagged and uploaded like :  <code>dockerhub starax/service-frontend-voting:test</code>
You can do these steps</p>
<ul>
<li><p><code>eval $(minikube docker-env) </code></p>
</li>
<li><p><code>docker images</code> =&gt; check the IMAGE IDs and name of images and their tags</p>
</li>
<li><p><code>docker pull  starax/service-frontend-voting:test </code> =&gt; this will download
the test tag</p>
</li>
<li><p>run <code>docker images </code>again  =&gt; to check  if image ID , tags are different than the previous onrd</p>
</li>
<li><p>After that in manifest file  <code>kubectl edit deploy service-frontend-voting </code> change <code>imagePullPolicy: IfNotPresent</code>
and <code>image: starax/service-frontend-voting:test</code></p>
</li>
</ul>
<p><strong>Notes</strong> the command 1. you used wont do anything, because deployment will recreate another pod even if you deleted that pod , the new pod will have the image that is indicated in deployment which is same the old version.<code>kubectl describe service-frontend-voting </code> to check name and tag of the image that being used ..</p>
<p>The command 2,3 will delete, then create a same  deployment as before, and the image pulled will be starax/service-frontend-voting:latest</p>
<p>To update image use =&gt;  <strong>4</strong></p>
<p>About 6, if you don't specify the tag of an image K8s will pulled that image with tag latest  tag.Also If you dont indicate imagePullPolicy then policy by default is Always ..</p>
<p>Also check <code>kubectl get events</code> is good command to tell you if you pulled a new image or no</p>
<p>I hope I helped</p>
