<p>I am using minikube to create k8s cluster. I am trying to create a pod. The pod is created but there is an error while pulling my image. When I try to run <code>kubectl describe pod posts</code>, I get the error below, but my image present locally.</p>
<pre><code>Failed to pull image &quot;suresheerf/posts&quot;: rpc error: code = Unknown desc = Error response from daemon: pull access denied for suresheerf/posts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
</code></pre>
<p>What's happening here? How to resolve it?</p>
<p>My K8s Pod yaml:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: posts
spec:
  containers:
    - name: posts
      image: suresheerf/posts

</code></pre>
<p>Also, my terminal screen shot:<a href="https://i.stack.imgur.com/B4EUK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B4EUK.png" alt="terminal" /></a></p>

Suresh D
<p>Some possible causes for the error are:</p>
<ul>
<li>The image or tag doesn’t exist.</li>
<li>You’ve made a typo in the image name or tag.</li>
<li>The image registry requires authentication.</li>
</ul>
<p>Check whether the image name is correct or not. Update the image name and tag correctly.</p>
<p>If you need to pull an image from a private image registry, you need to make sure that you provide Kubernetes with the credentials it will need to pull the image. You can do this by creating a Secret. You have to create a Secret containing the credentials you need to access. Also make sure that you’ve added the Secret in the appropriate namespace. You’ll also need to set the <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret" rel="nofollow noreferrer">imagePullSecrets</a> field on your Pod. This field tells Kubernetes which Secret it should use, when authenticating to the registry.</p>
<p><strong>Example :</strong></p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: myapp
spec:
  containers:
    - name: posts
      image: &lt;image name&gt;
      imagePullPolicy: Never
  imagePullSecrets:
  - name: the-secret


</code></pre>
<p>If Minikube is unable to directly access your local docker repository. There are several methods to resolve this issue. Refer <a href="https://minikube.sigs.k8s.io/docs/handbook/pushing/" rel="nofollow noreferrer">pulling images</a> for information.</p>
<p>One of the simple workarounds is, you can add the image to the Minikube cache using minikube cache add  and you need to change the imagePullPolicy inside your yaml file to Never. This way, it will default to using the local image you cached into your minikube. You can reload your cache as well after adding it in.</p>
