1
votes

I'm traying to create a Pod from a docker private image. For this i have created a secret like this:

kubectl create secret docker-registry $SECRETNAME --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL

and then in the pod yml file,

apiVersion: v1
kind: Pod
metadata:
  name: website.com
  labels: 
    app: website
spec:
  containers:
  - name: my-web
    image: company/web:1.0.2
    imagePullPolicy: Always
    command: [ "echo", "SUCCESS" ]
    ports:
    - name: web-port
      containerPort: 8080
  imagePullSecrets:
    - name: docker-hub-key

When I run "kubectl create -f web-pod.yml", and then I run "kubectl get pod website.com" I get the following error:

  • Failed to pull image "company/web:1.0.2": rpc error: code = Unknown desc = Error response from daemon: repository company/web not found: does not exist or no pull access
  • Back-off pulling image "company/web:1.0.2"

Please help, thanks in advance

1
is company something you're using for the sake of this post or are you actually using that?frankgreco
It may seem silly but can you list the images on the docker registry to see if that particular image is present along with the "1.0.2" tag?Jose Armesto
Are you sure $SECRETNAME == 'docker-hub-key', what do you get when you run kubectl get secret docker-hub-key -o yaml. Also, are you sure that the user has access to the image? It is common to push images with a users account but pull them into k8s with a system account. The repository will default to only giving access to the user that pushed the image initially.erk

1 Answers

2
votes

Since the fail is at the initial stage, this is probably an issue with authentication or repository-(image/tags access). Please verify that the repository name is valid and that the image version specified is available in the repository.

If all has been verified and the issue still persists, try do the following:

  • Restart docker service daemon
  • Check to confirm that the secret provided for the repo is valid
  • Try pull the image using kubectl command like below:

    $ kubectl run <deployment-name> --image=<repo>/<image>:<version> --port=8080

If the above command is successful, then it will help you rule out auth/access issues. If the issue is not solved, go through the logs to get more specifics on the problem.