Home > front end >  kubectl describe pod depl-im-54cbb55ccb-mjl6q
kubectl describe pod depl-im-54cbb55ccb-mjl6q

Time:01-02

Once I installed docker and run it, I install kubernetes also, then I installed minikube and start it. I create some deployments by kubectl create deployment --image=imageName imageName when I get the pods I these results, I want a solution I tried to understand kubernetes errors but I did not, when I get my pods I get these:

PS C:\Users\ahmed> kubectl get pods
NAME                        READY   STATUS         RESTARTS   AGE
depl-im-54cbb55ccb-mjl6q    0/1     ErrImagePull   0          86m
ngnix-app-8d489bb64-tlvrn   0/1     ErrImagePull   0          15h

And when describe one (like 'ngnix-app-8d489bb64-tlvrn') I get:

PS C:\Users\ahmed> kubectl describe pod depl-im-54cbb55ccb-mjl6q

Name:depl-im-54cbb55ccb-mjl6q

Namespace:    default

Priority:     0

Node:         minikube/192.168.49.2

Start Time:   Sat, 01 Jan 2022 12:26:05  0200

Labels:       app=depl-im
              pod-template-hash=54cbb55ccb

Annotations:  <none>
Status:       Pending

IP:           172.17.0.4
IPs:
  IP:           172.17.0.4
Controlled By:  ReplicaSet/depl-im-54cbb55ccb

Containers:
  depl-im:
    Container ID:
    Image:          depl-im
    Image ID:
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>


Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-b9f8h (ro)

Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True

Volumes:
  kube-api-access-b9f8h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
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       86m                  default-scheduler  Successfully assigned default/depl-im-54cbb55ccb-mjl6q to minikube
  Normal   Pulling         84m (x4 over 86m)    kubelet            Pulling image "depl-im"
  Warning  Failed          84m (x4 over 86m)    kubelet            Failed to pull image "depl-im": rpc error: code = Unknown desc = Error response from daemon: pull access denied for depl-im, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          84m (x4 over 86m)    kubelet            Error: ErrImagePull
  Warning  Failed          84m (x6 over 86m)    kubelet            Error: ImagePullBackOff
  Normal   BackOff         56m (x128 over 86m)  kubelet            Back-off pulling image "depl-im"
  Normal   SandboxChanged  114s                 kubelet            Pod sandbox changed, it will be killed and re-created.
  Normal   BackOff         33s (x2 over 61s)    kubelet            Back-off pulling image "depl-im"
  Warning  Failed          33s (x2 over 61s)    kubelet            Error: ImagePullBackOff
  Normal   Pulling         18s (x3 over 80s)    kubelet            Pulling image "depl-im"
  Warning  Failed          15s (x3 over 62s)    kubelet            Failed to pull image "depl-im": rpc error: code = Unknown desc = Error response from daemon: pull access denied for depl-im, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          15s (x3 over 62s)    kubelet            Error: ErrImagePull

CodePudding user response:

If this image that kubernetes tries to pull is hosted by a private image repository, you need to place a secret that includes the credentials in the same kubernetes namespace where your deployments / pods are deployed in.

Then, use

imagePullSecrets:
  - name: secret-name

in your deployment spec.

For reference: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

If you try to use a locally built docker image in Kubernetes, please have a look at the following: https://medium.com/swlh/how-to-run-locally-built-docker-images-in-kubernetes-b28fbc32cc1d

CodePudding user response:

Please use below command to login first on the repository where your image is located :

#docker login `repository url` -u `username` -p `password` 

Then try to get this manually:

#docker pull `imagename`
  • Related