<p>Hello Guys hope you well!</p>

<p>I need the that my master machine order the slave to pull the image from my docker hub repo and I get the error below, It doesn't let the slave pull from the repo, but when I go to the slave, manually pull he pulls</p>

<p>This from kubernetes master:</p>

<p>The first lines are a describe from pod my-app-6c99bd7b9c-dqd6l which is running now because I pulled manually the image from the docker hub, but I want Kubernetes to do it.</p>

<pre><code>Events:
  Type     Reason          Age                            From                           Message
  ----     ------          ----                           ----                           -------
  Normal   Scheduled       &lt;unknown&gt;                      default-scheduler              Successfully assigned default/my-app2-74969ddd4f-l6d6l to kubeslave.machine.pt
  Normal   SandboxChanged  &lt;invalid&gt;                      kubelet, kubeslave.machine.pt  Pod sandbox changed, it will be killed and re-created.
  Warning  Failed          &lt;invalid&gt; (x3 over &lt;invalid&gt;)  kubelet, kubeslave.machine.pt  Failed to pull image "bedjase/repository/my-java-app:my-java-app": rpc error: code = Unknown desc = Error response from daemon: pull access denied for bedjase/repository/my-java-app, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed          &lt;invalid&gt; (x3 over &lt;invalid&gt;)  kubelet, kubeslave.machine.pt  Error: ErrImagePull
  Normal   BackOff         &lt;invalid&gt; (x7 over &lt;invalid&gt;)  kubelet, kubeslave.machine.pt  Back-off pulling image "bedjase/repository/my-java-app:my-java-app"
  Warning  Failed          &lt;invalid&gt; (x7 over &lt;invalid&gt;)  kubelet, kubeslave.machine.pt  Error: ImagePullBackOff
  Normal   Pulling         &lt;invalid&gt; (x4 over &lt;invalid&gt;)  kubelet, kubeslave.machine.pt  Pulling image "bedjase/repository/my-java-app:my-java-app"
[root@kubernetes ~]# kubectl get pods
NAME                       READY   STATUS             RESTARTS   AGE
my-app-6c99bd7b9c-dqd6l    1/1     Running            0          14m
my-app2-74969ddd4f-l6d6l   0/1     ImagePullBackOff   0          2m20s
nginx-86c57db685-bxkpl     1/1     Running            0          8h
</code></pre>

<p>This from slave:</p>

<pre><code>[root@kubeslave docker]# docker pull bedjase/repository:my-java-app
my-java-app: Pulling from bedjase/repository
50e431f79093: Already exists
dd8c6d374ea5: Already exists
c85513200d84: Already exists
55769680e827: Already exists
e27ce2095ec2: Already exists
5943eea6cb7c: Already exists
3ed8ceae72a6: Already exists
7ba151cdc926: Already exists
Digest: sha256:c765d09bdda42a4ab682b00f572fdfc4bbcec0b297e9f7716b3e3dbd756ba4f8
Status: Downloaded newer image for bedjase/repository:my-java-app
docker.io/bedjase/repository:my-java-app
</code></pre>

<p>I already made the login in both master and slave to docker hub repo and succeed.
Both have /etc/hosts ok, also nodes are connected and ready:</p>

<pre><code>[root@kubernetes ~]# kubectl get nodes
NAME                    STATUS   ROLES    AGE   VERSION
kubernetes.machine.pt   Ready    master   26h   v1.17.4
kubeslave.machine.pt    Ready    &lt;none&gt;   26h   v1.17.4
</code></pre>

<p>Am I missing some point here? </p>

Bedjase
<p>For private images you must create a <code>secret</code> with <code>username</code> and <code>password</code> of Docker Hub to Kubernetes be able to pull the image.</p>

<p>The command bellow create a secret name <code>regcred</code> with your Docker Hub credentials, replace the fields <code>&lt;&lt;your-name&gt;&gt;</code>, <code>&lt;your-password&gt;</code> and <code>&lt;your-email&gt;</code>:</p>

<pre class="lang-sh prettyprint-override"><code>kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=&lt;your-name&gt; --docker-password=&lt;your-password&gt; --docker-email=&lt;your-email&gt;
</code></pre>

<p>After that you need to add in your pod/deployment spec that you want to use this credentials to pull your private image adding the <code>imagePullSecrets</code> with the credentials created above, see this example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: &lt;your-private-image&gt;
  imagePullSecrets:
  - name: regcred
</code></pre>

<p><strong>References:</strong></p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret</a></p>
