geerlingguy / kubernetes-101

Kubernetes 101 - by Jeff Geerling
https://kube101.jeffgeerling.com/
MIT License
555 stars 166 forks source link

Unable to download `geerlingguy/kube101:intro` #10

Closed raed667 closed 3 years ago

raed667 commented 3 years ago

First of all, thank you for this tutorial!

I started to follow with the first video, but when i got to the step minikube service hello-k8s the browser page opens with an error message This site can’t be reached.

When I did kubectl get pods :

NAME                         READY   STATUS             RESTARTS   AGE
hello-k8s-75d8c7c996-c4c46   0/1     ImagePullBackOff   0          22s
$ kubectl logs hello-k8s-75d8c7c996-c4c46
Error from server (BadRequest): container "kube101" in pod "hello-k8s-75d8c7c996-c4c46" is waiting to start: trying and failing to pull image

When i did kubectl describe pod hello-k8s-75d8c7c996-c4c46:

Name:         hello-k8s-75d8c7c996-c4c46
Namespace:    default
Priority:     0
Node:         minikube/192.168.64.4
Start Time:   Sun, 06 Dec 2020 15:01:13 +0100
Labels:       app=hello-k8s
              pod-template-hash=75d8c7c996
Annotations:  <none>
Status:       Pending
IP:           172.17.0.2
IPs:
  IP:           172.17.0.2
Controlled By:  ReplicaSet/hello-k8s-75d8c7c996
Containers:
  kube101:
    Container ID:
    Image:          geerlingguy/kube101:intro
    Image ID:
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ErrImagePull
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-rztr5 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-rztr5:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-rztr5
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  33s                default-scheduler  Successfully assigned default/hello-k8s-75d8c7c996-c4c46 to minikube
  Warning  Failed     33s                kubelet            Failed to pull image "geerlingguy/kube101:intro": 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.64.1:53: read udp 192.168.64.4:54750->192.168.64.1:53: read: connection refused
  Normal   Pulling    16s (x2 over 33s)  kubelet            Pulling image "geerlingguy/kube101:intro"
  Warning  Failed     16s (x2 over 33s)  kubelet            Error: ErrImagePull
  Warning  Failed     16s                kubelet            Failed to pull image "geerlingguy/kube101:intro": 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.64.1:53: read udp 192.168.64.4:47285->192.168.64.1:53: read: connection refused
  Normal   BackOff    5s (x3 over 32s)   kubelet            Back-off pulling image "geerlingguy/kube101:intro"
  Warning  Failed     5s (x3 over 32s)   kubelet            Error: ImagePullBackOff

Any idea on where I should start looking ?

PS: Doing a basic docker pull geerlingguy/kube101:intro from my machine works as expected.

geerlingguy commented 3 years ago

It looks like a networking issue here:

Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53: read udp 192.168.64.4:47285->192.168.64.1:53: read: connection refused

See: https://stackoverflow.com/a/57364158

raed667 commented 3 years ago

@geerlingguy Thanks for the hint!

For future reference, this https://github.com/kubernetes/minikube/issues/4589#issuecomment-614631444 solved it for me. It was a DNS issue.