<p>I’m attempting to pull a private docker image into a digital ocean Kubernetes cluster. I receive this error:</p>
<blockquote>
<p>Failed to pull image &quot;testuser/services:latest&quot;: rpc error: code =
Unknown desc = failed to pull and unpack image
&quot;docker.io/testuser/services:latest&quot;: failed to resolve reference
&quot;docker.io/testuser/services:latest&quot;: pull access denied, repository
does not exist or may require authorization: server message:
insufficient_scope: authorization failed</p>
</blockquote>
<p>I followed the guide to configure the private registry : <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/</a> , executing the command :</p>
<blockquote>
<p>kubectl create secret generic regcred <br />
--from-file=.dockerconfigjson=&lt;path/to/.docker/config.json&gt; <br />
--type=kubernetes.io/dockerconfigjson</p>
</blockquote>
<p>I'm following this guide for creating a Kubernetes cluster with Docker container on Kubernetes: <a href="https://www.digitalocean.com/community/tutorials/how-to-automate-deployments-to-digitalocean-kubernetes-with-circleci" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-automate-deployments-to-digitalocean-kubernetes-with-circleci</a></p>
<p>When I execute <code>kubectl apply -f ~/kube-general/</code> the pod is successfully created but fails to pull the image and displays above error.</p>
<p>To enable access to a private docker hub image I’ve added <code>imagePullSecrets</code> to app-service.yml :</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: testuser
  namespace: default
  labels:
    app: testuser
spec:
  replicas: 1
  selector:
    matchLabels:
      app: testuser
  template:
    metadata:
      labels:
        app: testuser
    spec:
      containers:
        - name: testuser
          image: testuser/services:latest
          ports:
            - containerPort: 5000
              name: http
      imagePullSecrets:
        - name: regcred
</code></pre>
<p>app-deployment.yaml:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: services
  namespace: default
  labels:
    app: services
spec:
  type: ClusterIP
  ports:
    - port: 5000
      targetPort: http
      name: http
  selector:
    app: services
</code></pre>
<p>Update:</p>
<p>pulling the image from my local machine works as expected:</p>
<pre><code>docker pull testuser/services:latest 
latest: Pulling from testuser/services
Digest: sha256:35db6c6e9344043a67abe2e0a2f2583c036479728c944dc4136494f0d09a44fe
Status: Image is up to date for testuser/services:latest
docker.io/testuser/services:latest
</code></pre>
<p>The process I've followed is same as: <a href="https://www.digitalocean.com/community/questions/private-docker-registry" rel="nofollow noreferrer">https://www.digitalocean.com/community/questions/private-docker-registry</a></p>

<p>Can you try below:</p>
<pre><code>kubectl create secret docker-registry dockerreg --docker-server=docker.io --docker-username=alloweduserid --docker-password=password --docker-email=user@abc.com
</code></pre>
