<p>I'm trying to deploy a custom pod on minikube and I'm getting the following message regardless of my twicks:</p>
<pre><code>Failed to load logs: container &quot;my-pod&quot; in pod &quot;my-pod-766c646c85-nbv4c&quot; is waiting to start: image can't be pulled
Reason: BadRequest (400)
</code></pre>
<p>I did all sorts of experiments based on <a href="https://minikube.sigs.k8s.io/docs/handbook/pushing/" rel="nofollow noreferrer">https://minikube.sigs.k8s.io/docs/handbook/pushing/</a> and <a href="https://number1.co.za/minikube-deploy-a-container-using-a-private-image-registry/" rel="nofollow noreferrer">https://number1.co.za/minikube-deploy-a-container-using-a-private-image-registry/</a> without success.
I ended up trying to use <code>minikube image load myimage:latest</code> and reference it in the container spec as:</p>
<pre><code>  ...
  containers:
    - name: my-pod
      image: myimage:latest
      ports:
        - name: my-pod
          containerPort: 8080
          protocol: TCP
   ...
</code></pre>
<p>Should/can I use <code>minikube image</code>?
If so, should I use the full image name <code>docker.io/library/myimage:latest</code> or just the image suffix <code>myimage:latest</code>?
Is there anything else I need to do to make minikube locate the image?
Is there a way to get the logs of the bad request itself to see what is going on (I don't see anything in the api server logs)?</p>
<p>I also see the following error in the minikube system:</p>
<pre><code>Failed to load logs: container &quot;registry-creds&quot; in pod &quot;registry-creds-6b884645cf-gkgph&quot; is waiting to start: ContainerCreating
Reason: BadRequest (400)
</code></pre>
<p>Thanks!
Amos</p>

<p>You should set the <a href="https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy" rel="nofollow noreferrer">imagePullPolicy</a> to <code>IfNotPresent</code>. Changing that will tell kubernetes to not pull the image if it does not need to.</p>
<pre class="lang-yaml prettyprint-override"><code>  ...
  containers:
    - name: my-pod
      image: myimage:latest
      imagePullPolicy: IfNotPresent
      ports:
        - name: my-pod
          containerPort: 8080
          protocol: TCP
   ...
</code></pre>
<p>A quirk of kubernetes is that if you specify an image with the <code>latest</code> tag as you have here, it will default to using <code>imagePullPolicy=Always</code>, which is why you are seeing this error.</p>
<p><a href="https://kubernetes.io/docs/concepts/containers/images/#imagepullpolicy-defaulting" rel="nofollow noreferrer">More on how kubernetes decides the default image pull policy</a></p>
<p>If you need your image to always be pulled in production, consider using <a href="https://helm.sh/docs/" rel="nofollow noreferrer">helm</a> to template your kubernetes yaml configuration.</p>
