Home > Enterprise >  minikube does not download a public docker image
minikube does not download a public docker image

Time:08-30

Good day!

I am facing a strange problem. I have a standard deployment that uses a public image. But when I create it, I get the error ImagePullBackOff

$ kubectl get pods

result

api-gateway-deployment-74968fbf5c-cvqwj   0/1     ImagePullBackOff   0          6h23m
api-gateway-gateway-deployment-74968fbf5c-hpdxb   0/1     ImagePullBackOff   0          6h23m
api-gateway-gateway-deployment-74968fbf5c-rctv6   0/1     ImagePullBackOff   0          6h23m

my deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-gateway-deployment
  labels:
    app: api-gateway-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api-gateway-deployment
  template:
    metadata:
      labels:
        app: api-gateway-deployment
    spec:
      containers:
      - name: api-gateway-node
        image: creatorsprodhouse/api-gateway:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 80

I am using the docker driver, is there anything I can do wrong?

minikube start --driver=docker

CodePudding user response:

I think your internet connection is slow. The timeout to pull an image is 120 seconds, so kubectl could not pull the image in under 120 seconds.

First, pull the image via Docker

docker image pull creatorsprodhouse/api-gateway:latest

Then load the downloaded image to minikube

minikube image load creatorsprodhouse/api-gateway:latest

And then everything will work because now kubectl will use the image that is stored locally.

CodePudding user response:

I tried to repro the issue on my env with no success. On my end pods are up and running.

Can you please let us know where you host minikube?

  • local
  • azure VM (under a VNET)
  • aws Vm (under a VPC)
  • google cloud
  • are you under a proxy or vpn?
  • can you ckeck if you can pull via docker pull the image (on your local, and also on minikube)
  • is the issue isolated only to this image?
  • Do you get the same issue if you follow this tutorial: https://kubernetes.io/docs/tutorials/hello-minikube/#create-a-docker-container-image ?
  • What is the output of sudo lsof -i :53 on your VM/local env ?

In my case your deployment worked like a charm, however I am wondering what is the output if you try with: imagePullPolicy: IfNotPresent

Can you please follow the troubleshooting plan:

minikube start --driver=docker
kubectl get deployment
kubectl describe deployment api-gateway-deployment
kubectl get pods
kubectl describe pod <put-here-pod-name> #look at the end at Events Message
kubectl logs <put-here-pod-name>

#get minikube logs
minikube logs

#try to pull from minikube
minikube ssh
docker@minikube:~$ docker pull creatorsprodhouse/api-gateway:latest
docker@minikube:~$ docker image ls

You can also try to stop, delete, and recreate the minikube env

minikube stop
eval $(minikube docker-env -u)
minikube delete

minikube start
eval $(minikube docker-env)

kubectl apply -f deployment.yaml

Docs: https://minikube.sigs.k8s.io/docs/drivers/docker/

  • Related