I have a docker image created user-service and tagged it to localhost:5001
I have a local registry running at PORT 5001
User-service pushed to local registry
and created pod using deploy_new.yaml file
apiVersion: v1
kind: Pod
metadata:
name: user-service
labels:
component: web
spec:
containers:
- name: web
image: localhost:5001/user-service
resources:
limits:
memory: 512Mi
cpu: "1"
requests:
memory: 256Mi
cpu: "0.2"
imagePullPolicy: Never
ports:
- name: http
containerPort: 4006
protocol: TCP
livenessProbe:
httpGet:
path: /health/health
port: 4006
initialDelaySeconds: 3
periodSeconds: 3
failureThreshold: 2
readinessProbe:
httpGet:
path: /health/health
port: 4006
initialDelaySeconds: 15
periodSeconds: 10
Questions :
- What is ErrImageNeverPull image and how to fix it?
- How to test liveliness and readiness probes?
2
Answers
1. What is ErrImageNeverPull image and how to fix it?
As the
imagePullPolicy
is set toNever
the kubelet won’t fetch images but look for what is present locally. The error means it could not found the image locally and it will not try to fetch it.If the cluster can reach to your local docker registry, just change the
image: user-service
toimage: localhost:5000/user-service:latest
If you are using minikube, check the README to reuse your docker daemon so you can use your image without uploading it.
eval $(minikube docker-env)
on each session you need to use it.docker build -t user-service .
image: user-service
imagePullPolicy: Never
for your container (which you already have)2. How to test liveliness and readiness probes?
I suggest you try the examples form the Kubernetes documentation they explain really good the difference between the two and the different types of probes you can configure.
You need first to make your pod running before checking liveness and readiness probes. But in your case they will succeed as soon as the Pod starts. Just describe it and see the events.
One more thing to note.
eval $(minikube docker-env)
will fail silently if you are using a non-defaultminikube
profile, leading to the observed behavior:To address this re-run specifying the profile you are using: