<p>I can't get Kubernetes to pull my private docker image.</p>
<p>I have a kubernetes secret called <code>regcred</code> in my <code>default</code> namespace looking like:</p>
<pre class="lang-json prettyprint-override"><code>{&quot;auths&quot;: {&quot;index.docker.io&quot;: {&quot;username&quot;: &quot;Username&quot;, &quot;password&quot;: &quot;Password&quot;, &quot;email&quot;: &quot;random@email.com&quot;, &quot;auth&quot;: &quot;VXNlcm5hbWU6UGFzc3dvcmQ=&quot;}}}
</code></pre>
<p>The auth is <code>Username:Password</code> b64 encoded.</p>
<p>This is the pod I am trying to create which just fails everytime with <code>ImagePullBackOff</code>.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: index.docker.io/jor2/hello-world:latest
  imagePullSecrets:
  - name: regcred
</code></pre>
<p>logs:</p>
<pre class="lang-sh prettyprint-override"><code>Error from server (BadRequest): container &quot;private-reg-container&quot; in pod &quot;private-reg&quot; is waiting to start: image can't be pulled
</code></pre>
<pre class="lang-sh prettyprint-override"><code>Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  67s                default-scheduler  Successfully assigned default/private-reg to 10.144.195.222
  Normal   Pulling    20s (x3 over 66s)  kubelet            Pulling image &quot;index.docker.io/jor2/hello-world&quot;
  Warning  Failed     17s (x3 over 63s)  kubelet            Failed to pull image &quot;index.docker.io/jor2/hello-world&quot;: rpc error: code = NotFound desc = failed to pull and unpack image &quot;docker.io/jor2/hello-world:latest&quot;: failed to unpack image on snapshotter overlayfs: unexpected media type text/html for sha256:361849f1befca621043d13cca4e9bee74861754154556e149340a455e53d1d35: not found
  Warning  Failed     17s (x3 over 63s)  kubelet            Error: ErrImagePull
  Normal   BackOff    3s (x3 over 63s)   kubelet            Back-off pulling image &quot;index.docker.io/jor2/hello-world&quot;
  Warning  Failed     3s (x3 over 63s)   kubelet            Error: ImagePullBackOff
</code></pre>
<p>The secret looks like:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
data:
  .dockerconfigjson: eyJhdXRocyI6IHsiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogeyJ1c2VybmFtZSI6ICJVc2VybmFtZSIsICJwYXNzd29yZCI6ICJQYXNzd29yZCIsICJlbWFpbCI6ICJyYW5kb21AZW1haWwuY29tIiwgImF1dGgiOiAiVlhObGNtNWhiV1U2VUdGemMzZHZjbVE9In19fQo=
kind: Secret
metadata:
  creationTimestamp: &quot;2022-04-25T18:59:03Z&quot;
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:data:
        .: {}
        f:.dockerconfigjson: {}
      f:type: {}
    manager: kubectl-create
    operation: Update
    time: &quot;2022-04-25T18:59:03Z&quot;
  name: regcred
  namespace: default
  resourceVersion: &quot;270226&quot;
  uid: bbb1310b-421a-4c93-8488-498e7a52095f
type: kubernetes.io/dockerconfigjson
</code></pre>
<p>Any idea where I am going wrong?</p>

<p>It was a problem with my image and the pod spec needed to be:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: jor2/hello-world:latest
  imagePullSecrets:
  - name: regcred
</code></pre>
