0
votes

Hi I am new to minikube/k8s and trying to setup a first job in pod. I am running on windows and keep on getting error while pulling image.

My docker has already has image that i have used in job.yaml but minikube is failing with

Events:
  Type     Reason     Age   From               Message
  ----     ------     ----  ----               -------
  Normal   Scheduled  28s   default-scheduler  Successfully assigned default/say-something-blbwp to minikube
  Normal   Pulling    27s   kubelet, minikube  Pulling image "java"
  Warning  Failed     17s   kubelet, minikube  Failed to pull image "java": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.67.65:53: read udp 192.168.67.70:58499->192.168.67.65:53: i/o timeout
  Warning  Failed     17s   kubelet, minikube  Error: ErrImagePull
  Normal   BackOff    17s   kubelet, minikube  Back-off pulling image "java"
  Warning  Failed     17s   kubelet, minikube  Error: ImagePullBackOff

Here is my job.yaml file

apiVersion: batch/v1
kind: Job
metadata:
 name: say-something
spec:
 template:
   metadata:
     name: say-something
   spec:
     containers:
     - name: say-something
       image: java
       imagePullPolicy: IfNotPresent
       command: [System.out.println("ZXZAA:")]
     restartPolicy: OnFailure

docker images

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
hello-world                 latest              bf756fb1ae65      7 months ago        13.3kB
java                        latest              d23bdf5b1b1b        3 years ago         643MB

Can someone please guide on what I am missing? Any specific settings I need to do on registry part?

1
Thanks for reply! docker hello-world works fine for me! will try other stepsParth
I have tried it changing the host file and putting current Ip But still getting same error kubelet, minikube Failed to pull image "java": rpc error: code = Unknown desc = Error response from daemon: Get registry-1.docker.io/v2: dial tcp: lookup registry-1.docker.io on 192.168.67.65:53: read udp 192.168.67.70:45381->192.168.67.65:53: i/o timeout IP CONFIG : 34.228.211.243 registry-1.docker.io/v2/ # Added by Docker Desktop 192.168.67.65 host.docker.internal 192.168.67.65 gateway.docker.internalParth
any other workaround?Parth
Is there actually a Docker Hub image named just java? hub.docker.com/_/java redirects to the page for the openjdk image. (You can't write Java code in the "command" part of the job spec, and you probably need to build a custom image for this.)David Maze

1 Answers

0
votes

For solving kubelet, minikube Error: ImagePullBackOff I changed docker settings, created docker ID

restarting docker desktop and using Resources -> Network -> DNS Server -> manual DNS configuration as 8.8.8.8 and also removing obsolete Ips from host file as mentioned in https://github.com/docker/for-win/issues/4884# after that it worked fine and able to pull images

@David Maze is right we need to have openjdk for java and we need to deploy our app as image.

@Wiktor if you want to setup java application through K8s you can refer to https://www.oreilly.com/content/how-to-manage-docker-containers-in-kubernetes-with-java/