skip to Main Content

Failed to pull image "/posts:0.0.1": rpc error: code =
Unknown desc = Error response from daemon: pull access denied for
/posts, repository does not exist or may require ‘docker
login’: denied: requested access to the resource is denied

Debian 10, minikube and kubectl installed and docker.
if i run docker with this image – all is fine.

pavel@debian:~$ kubectl version Client Version:
version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4",
GitCommit:"123",
GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z",
GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"} Server
Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4",
GitCommit:"123",
GitTreeState:"clean", BuildDate:"2020-11-11T13:09:17Z",
GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}

posts.yaml

apiVersion: v1
kind: Pod
metadata:
  name: posts
spec:
  containers:
    - name: posts
      image: <mylogin>/posts:0.0.1

kubectl apply -f posts.yaml

debian:~$ kubectl describe pod posts

Name:         posts
Namespace:    default
Priority:     0
Node:         minikube/192.168.49.2
Start Time:   Wed, 25 Nov 2020 07:06:47 +0400
Labels:       <none>
Annotations:  <none>
Status:       Pending
IP:           172.17.0.4
IPs:
  IP:  172.17.0.4
Containers:
  posts:
    Container ID:   
    Image:          <mylogin>/posts:0.0.1
    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 default-token-b9gkg (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-b9gkg:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-b9gkg
    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  23m                   default-scheduler  Successfully assigned default/posts to minikube
  Normal   Pulling    21m (x4 over 23m)     kubelet            Pulling image "<mylogin>/posts:0.0.1"
  Warning  Failed     21m (x4 over 23m)     kubelet            Failed to pull image "<mylogin>/posts:0.0.1": rpc error: code = Unknown desc = Error response from daemon: pull access denied for <mylogin>/posts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed     21m (x4 over 23m)     kubelet            Error: ErrImagePull
  Warning  Failed     7m53s (x63 over 23m)  kubelet            Error: ImagePullBackOff
  Normal   BackOff    2m58s (x84 over 23m)  kubelet            Back-off pulling image "<mylogin>/posts:0.0.1"

3

Answers


  1. The image name is incorrect. Update the image name and tag correctly. If the image is hosted in private registry then you need to create the registry secret that has credentials to login to your private registry. Follow the below link for further help
    https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

    Login or Signup to reply.
  2. Minikube is unable to directly access your local docker repository. There are several methods to resolve this and they are elaborated upon here: https://minikube.sigs.k8s.io/docs/handbook/pushing/

    Personally, I simply added the image to the Minikube cache using minikube cache add <image tag> and you need to change the imagePullPolicy inside your yaml file to Never. This way, it will default to using the local image you cached into your minikube. You can reload your cache as well after adding it in. This is probably the simplest way if you use Docker to test the containers before adding them to the cluster.

    You can give the other methods a try as well including using the daemon inside Minikube to build the container image directly.

    Login or Signup to reply.
  3. Minikube is unable to directly access your local docker repository. I can solution this with:

    minikube image load

    And you must set imagePullPolicy to IfNotPresent.

    I hope i helped.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search