<p>I have a single private repository on Docker. It contains a simple ASP.Net project. The full URL is <code>https://hub.docker.com/repository/docker/MYUSERNAME/testrepo</code>. I can push an image to it using these commands: </p>

<pre><code>$ docker tag myImage MYUSERNAME/testrepo
$ docker push MYUSERNAME/testrepo
</code></pre>

<p>I have created this secret in Kubernetes: </p>

<pre><code>$ kubectl create secret docker-registry mysecret --docker-server="MYUSERNAME/testrepo" --docker-username=MY_USERNAME --docker-password="MY_DOCKER_PASSWORD" --docker-email=MY_EMAIL
</code></pre>

<p>Which successfully creates a secret in Kubernetes with my username and password. Next, I apply a simple deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: weather-deployment
  labels:
    app: weather
spec:
  replicas: 3
  selector:
    matchLabels:
      app: weather
  template:
    metadata:
      labels:
        app: weather
    spec:
      containers:
      - name: weather
        image: MYUSERNAME/testrepo:latest
        ports:
        - containerPort: 80
      imagePullSecrets:
      - name: mysecret
</code></pre>

<p>The deployment fails with this message:</p>

<pre><code>$ Failed to pull image "MYUSERNAME/testrepo:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for MYUSERNAME/testrepo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 
</code></pre>

<p>What am I doing wrong?</p>

yesman
<p>You should provide correct registry url  <code>--docker-server="MYUSERNAME/testrepo"</code>.
It is not docker image name. It should be your private registry url, if you use docker hub then the value should be <code>--docker-server="https://index.docker.io/v1/"</code>. From <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line" rel="nofollow noreferrer">this</a> document </p>

<pre><code>&lt;your-registry-server&gt; is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
</code></pre>
