<p>I have a docker image of a spring-boot helloworld app in a private docker registry. I am trying to create a K8s deployment that is supposed to pull this image, but after deployment, the pod is giving the following error:</p>
<pre><code>7m         Normal    Pulling                  pod/hello-world-deployment-68d9cd457c-xl6p4    Pulling image &quot;registry.hub.docker.com/projecthelloworld/helloworld-container:hello-world-service.V.0&quot;
17m         Warning   Failed                   pod/hello-world-deployment-68d9cd457c-xl6p4    Failed to pull image &quot;registry.hub.docker.com/projecthelloworld/helloworld-container:hello-world-service.V.0&quot;: rpc error: code = Unknown desc = Error response from daemon: pull access denied for registry.hub.docker.com/projecthelloworld/helloworld-container, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
17m         Warning   Failed                   pod/hello-world-deployment-68d9cd457c-xl6p4    Error: ErrImagePull
17m         Normal    BackOff                  pod/hello-world-deployment-68d9cd457c-xl6p4    Back-off pulling image &quot;registry.hub.docker.com/projecthelloworld/helloworld-container:hello-world-service.V.0&quot;
</code></pre>
<p>In order to create the deployment, I first created a secret yaml with a secret name <code>regcred</code>.:</p>
<pre><code>kubectl create secret docker-registry --dry-run=client regcred \
--docker-server=https://index.docker.io/v1/ \
--docker-username=projecthelloworld \
--docker-password=HelloWorld240721 \
--docker-email=hello.world@gmail.com \
-o yaml &gt; docker-secret.yaml
</code></pre>
<p>Here is the generated <code>docker-secret.yaml</code> is</p>
<pre><code>apiVersion: v1
data:
  .dockerconfigjson: eyJhdXRocyI6eyJodHRwczovL2luZGV4LmRvY2tlci5pby92MS8iOnsidXNlcm5hbWUiOiJwcm9qZWN0aGVsbG93b3JsZCIsInBhc3N3b3JkIjoiSGVsbG9Xb3JsZDI0MDcyMSIsImVtYWlsIjoiaGVsbG8ud29ybGRAZ21haWwuY29tIiwiYXV0aCI6ImNISnZhbVZqZEdobGJHeHZkMjl5YkdRNlNHVnNiRzlYYjNKc1pESTBNRGN5TVE9PSJ9fX0l
kind: Secret
metadata:
  creationTimestamp: null
  name: regcred
type: kubernetes.io/dockerconfigjson
</code></pre>
<p>Then I created the following <code>hello-world-deploy.yml</code> deployment file.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world-deployment
  labels:
    app: hello-world-app
spec:
  selector:
    matchLabels:
      app: hello-world-app
  template:
    metadata:
      labels:
        app: hello-world-app
    spec:
      containers:
      - name: hello-world-app
        image: registry.hub.docker.com/projecthelloworld/helloworld-container:V1
        resources:
          limits:
            memory: &quot;128Mi&quot;
            cpu: &quot;500m&quot;
        ports:
          - containerPort: 80

      imagePullSecrets:
      - name: regcred
</code></pre>
<p>Following the above, I created deployment but the pod is showing the status <code>ErrImagePull</code></p>
<p>On describing the pod, I can see that the secrets are mounted as expected.</p>
<pre><code>Name:         hello-world-deployment-b74c8c7db-26r2f
Namespace:    default
Priority:     0
Node:         ip-192-168-41-226.eu-west-2.compute.internal/192.168.41.226
Start Time:   Tue, 03 Aug 2021 13:53:17 +0100
Labels:       app=hello-world-app
              pod-template-hash=b74c8c7db
Annotations:  kubernetes.io/psp: eks.privileged
Status:       Pending
IP:           192.168.51.2
IPs:
  IP:           192.168.51.2
Controlled By:  ReplicaSet/hello-world-deployment-b74c8c7db
Containers:
  hello-world-app:
    Container ID:
    Image:          registry.hub.docker.com/projecthelloworld/helloworld-container:hello-world-service.V.0
    Image ID:
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  128Mi
    Requests:
      cpu:        500m
      memory:     128Mi
    Environment:  &lt;none&gt;
Mounts:
  /var/run/secrets/kubernetes.io/serviceaccount from default-token-h8j4t (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-h8j4t:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-h8j4t
    Optional:    false
</code></pre>
<p>I am not sure, in which step I am going wrong. Any help would greatly appreciated.</p>

tintin
<p>The error message tells that there is a permission problem:</p>
<blockquote>
<p>... pull access denied for
registry.hub.docker.com/projecthelloworld/helloworld-container,
repository does not exist or may require 'docker login': denied:
requested access to the resource is denied</p>
</blockquote>
<p>So I think, you've forgotten to specify <code>imagePullSecrets</code>:</p>
<pre><code>spec:
  imagePullSecrets:
    - name: regcred
</code></pre>
