skip to Main Content

I have a docker image created user-service and tagged it to localhost:5001
I have a local registry running at PORT 5001

enter image description here

User-service pushed to local registry

enter image description here

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

But on describing pod
I get enter image description here

Questions :

  1. What is ErrImageNeverPull image and how to fix it?
  2. How to test liveliness and readiness probes?

Probe APIs
enter image description here

2

Answers


  1. 1. What is ErrImageNeverPull image and how to fix it?

    As the imagePullPolicyis set to Never 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 to image: 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.

    1. Do eval $(minikube docker-env) on each session you need to use it.
    2. Build the image docker build -t user-service .
    3. Add the image in your Pod manifest as image: user-service
    4. make sure you have 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.

    Login or Signup to reply.
  2. One more thing to note. eval $(minikube docker-env) will fail silently if you are using a non-default minikube profile, leading to the observed behavior:

    $ eval $(minikube docker-env)
    $ minikube docker-env
    🤷  Profile "minikube" not found. Run "minikube profile list" to view all profiles.
    👉  To start a cluster, run: "minikube start"
    $
    

    To address this re-run specifying the profile you are using:

    $ eval $(minikube -p my-profile docker-env)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search