<p>I have a VM with kubernetes installed using kubeadm (NOT minikube). The VM acts a the single node of the cluster, with taints removed to allow it to act as both Master and Worker node (as shown in the kubernetes documentation).
I have saved, transfered and loaded a my <em>app:test</em> image into it. I can easily run a container with it using docker run.
It shows up when I run <em>sudo docker images</em>.</p>
<p>When I create a deployment/pod that uses this image and specify <em>Image-PullPolicy: IfNotPresent</em> or <em>Never</em>, I still have the <em>ImagePullBackoff</em> error. The describe command shows me it tries to pull the image from dockerhub...</p>
<p>Note that when I try to use a local image that was <em>pulled as the result of creating another pod</em>, the ImagePullPolicies seem to work, no problem. Although the <em>image doesn't appear when i run sudo docker images --all</em>.</p>
<p>How can I use a local image for pods in kubernetes? Is there a way to do it without using a private repository?</p>

Olivier
<h2>One can do so with a combination of crictl and ctr, if using containerd.</h2>
<p><strong>TLDR:</strong> <a href="https://blog.scottlowe.org/2020/01/25/manually-loading-container-images-with-containerd/" rel="nofollow noreferrer">these steps</a>, which are also described in the crictl <a href="https://github.com/containerd/cri/blob/master/docs/crictl.md#directly-load-a-container-image" rel="nofollow noreferrer">github documentation</a>:</p>
<p>1- Once you get the image on the node (in my case, a VM), make sure it is in an archive (.tar). You can do that with the <code>docker save</code> or <code>ctr image export</code> commands.</p>
<p>2- Use <code>sudo ctr -n=k8s.io images import myimage.tar</code> while in the same directory as thearchived image to add it to containerd in the namespace that kubernetes uses to track it's images. It should now appear when you run <code>sudo crictl images</code>.</p>
<hr />
<p>As suggested, I tried listing images with crictl and my app:test did not appear. However, trying to import my local image through crictl didn't seem to work either. I used <em>crictl pull app:test</em> and it showed the following error message:</p>
<blockquote>
<p>FATA[0000] pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image &quot;docker.io/library/app:test&quot;: failed to resolve reference &quot;docker.io/library/app:test&quot;: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed.</p>
</blockquote>
<p>However, when following <a href="https://blog.scottlowe.org/2020/01/25/manually-loading-container-images-with-containerd/" rel="nofollow noreferrer">these steps</a>, my image is finally recognized as an existing local image in kubernetes. They are actually the same as suggested in the crictl <a href="https://github.com/containerd/cri/blob/master/docs/crictl.md#directly-load-a-container-image" rel="nofollow noreferrer">github documentation</a></p>
<p>How does one explain this? How do images get &quot;registered&quot; in the kubernetes cluster? Why couldn't crictl import the image? I might post another issue to ask that...</p>
