I have minikube running on Ubuntu 22.04. When I update a docker image, push it to dockerhub, delete the previous deployment, and apply the deployment the result in the log is from code that is several hours old.
I see the service is gone after doing kubectl delete -f deploy.yml
and exists after doing an apply
, but the logs show output from old code.
When I do a docker run ...
on the local docker image that was pushed to dockerhub the output shows the new code. I’ve verified that docker push ...
has uploaded the new code.
Is this a bug in minikube? Here’s my deployment script.
apiVersion: apps/v1
kind: Deployment
metadata:
name: metadata
spec:
replicas: 2
selector:
matchLabels:
app: metadata
template:
metadata:
labels:
app: metadata
spec:
containers:
- name: metadata
image: dwschulze/metadata:1.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8081
---
apiVersion: v1
kind: Service
metadata:
name: metadata
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 8081
selector:
app: metadata
2
Answers
in your deployment script have:
you need to change to:
The "Always" value allows you to pull an image every time you deploy
I hope I helped 🙂
Below troubleshooting steps will help you to resolve your issue:
Can you cross check that the deployment is using the
dwschulze/metadata:1.0.0
image with thekubectl describ
e command.If you find another image, delete deployment using
kubectl delete
.Cross verify that deleted deployment is not created again, addimagePullPolicy: Never
and redeploy. You can also refer to the suggestions given by member ‘svenwltr’ in the post.If your issue is still persisting, try another method to push images like cache. Before using this method check if you have any previously cached images and try to remove them.
Check the logs of the deployment to see if there are any errors or issues preventing the updated Docker image from being loaded.