<p>I logged in using docker login command in my machine.</p>
<p>then I tried to run the <code>kubectl</code> command to apply a <code>yaml</code> file:</p>
<p><code>kubectl apply -f manifests/1_helloworld_deploy.yaml</code></p>
<p>but this failed with error :</p>
<blockquote>
<p>Warning  Failed     20s (x2 over 35s)  kubelet            Failed to pull image &quot;nginx:latest&quot;: rpc error: code = Unknown desc = failed to pull and unpack image &quot;docker.io/library/nginx:latest&quot;: failed to copy: httpReaderSeeker: failed open: unexpected status code <a href="https://registry-1.docker.io/v2/library/nginx/manifests/sha256:89ea560b277f54022cf0b2e718d83a9377095333f8890e31835f615922071ddc" rel="nofollow noreferrer">https://registry-1.docker.io/v2/library/nginx/manifests/sha256:89ea560b277f54022cf0b2e718d83a9377095333f8890e31835f615922071ddc</a>: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: <a href="https://www.docker.com/increase-rate-limit" rel="nofollow noreferrer">https://www.docker.com/increase-rate-limit</a></p>
</blockquote>
<p>Now, I already logged in using the docker username and account, still I'm getting a pull rate error.</p>
<p>What should I do to make this working for <code>.yaml</code> file also?</p>

<ul>
<li>When you login to docker on a machine , its credentials will be saved in a file named <code>~/.docker/config.json</code></li>
<li>We need need to explicitly instruct these credentials to be used while pulling images .</li>
<li>For that we need to create a secret with contents of <code>~/.docker/config.json</code> and mention that as <code>imagePullSecrets</code> in the yaml file.</li>
</ul>
<p>Following is a sample procedure :</p>
<pre><code>kubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=/root/.docker/config.json

In the podspec update it as image pull secret as following :

apiVersion: v1
kind: Pod
metadata:
  name: boo
spec:
  containers:
    - name: boo
      image: busybox
  imagePullSecrets:
    - name: my-secret
</code></pre>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">Detailed Documentation</a></p>
