<p>I have a Jhipster application which I want to deploy to Kubernetes. I used the <code>jhipster kubernetes</code> command to create all the k8s objects and I provided an Docker Hub repository in which to push them. The Docker Hub repository is a private one. </p>

<p>The deployment object looks like:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
    name: demodevices
    namespace: demo
spec:
    replicas: 1
    selector:
        matchLabels:
            app: demodevices
            version: 'v1'
    template:
        metadata:
            labels:
                app: demodevices
                version: 'v1'
        spec:
            initContainers:
                - name: init-ds
                  image: busybox:latest
                  command:
                      - '/bin/sh'
                      - '-c'
                      - |
                          while true
                          do
                            rt=$(nc -z -w 1 demodevices-postgresql 5432)
                            if [ $? -eq 0 ]; then
                              echo "DB is UP"
                              break
                            fi
                            echo "DB is not yet reachable;sleep for 10s before retry"
                            sleep 10
                          done
            containers:
                - name: demodevices-app
                  image: myRepo/demo:demodevices-1.0.0
                  env: ...
                  resources: ...
                  ports: ...
                  readinessProbe: ...
                  livenessProbe: ...
            imagePullSecrets:
            - name: regcred
</code></pre>

<p>Because I used a private Docker Hub repo, I added the <code>imagePullSecret</code>. The secret is created and deployed to k8s. </p>

<p>When applying the file, in the pods I see the following messages: </p>

<pre><code> Warning  Failed     &lt;invalid&gt; (x4 over &lt;invalid&gt;)  kubelet, k8node1   Failed to pull image "busybox:latest": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/library/busybox/manifests/latest: unauthorized: incorrect username or password
 Warning  Failed     &lt;invalid&gt; (x4 over &lt;invalid&gt;)  kubelet, k8node1   Error: ErrImagePull
 Normal   BackOff    &lt;invalid&gt; (x6 over &lt;invalid&gt;)  kubelet, k8node1   Back-off pulling image "busybox:latest"
 Warning  Failed     &lt;invalid&gt; (x6 over &lt;invalid&gt;)  kubelet, k8node1   Error: ImagePullBackOff
</code></pre>

<p>As I understood, it tries do pull the busybox:latest image using the credentials for the private repository. The expected result is to pull the busybox:latest without errors and pull my custom image from my private repo. How to fix the above issue?</p>

<p>This error is not connected to the fact you are using <code>imagePullSecret</code>. </p>

<p><a href="https://kubernetes.io/docs/concepts/containers/images/#creating-a-secret-with-a-docker-config" rel="nofollow noreferrer">Review</a> the process you used to create your secret, here is an example: </p>

<pre><code>kubectl create secret docker-registry anyname \
--docker-server=docker.io \
--docker-username=&lt;username&gt; \
--docker-password=&lt;password&gt; \
--docker-email=&lt;email&gt;
</code></pre>

<p>I have reproduced your case and I have the same error when I create the secret with wrong information. </p>
