<p>Just study the core of K8S on local machine (Linux Mint 20.2).</p>
<p>Created one node cluster locally with:</p>
<blockquote>
<p>k3d cluster create mycluster</p>
</blockquote>
<p>And now I want to run spring boot application in a container.<br />
I build local image:</p>
<blockquote>
<p>library:0.1.0</p>
</blockquote>
<p>And here is snippet from <code>Deployment.yml</code>:</p>
<pre><code>spec:
  terminationGracePeriodSeconds: 40
  containers:
    - name: 'library'
      image: library:0.1.0
      imagePullPolicy: IfNotPresent
</code></pre>
<p>Despite the fact that image is already built:</p>
<pre><code>docker images
REPOSITORY    TAG       IMAGE ID       CREATED             SIZE
library       0.1.0     254c13416f46   About an hour ago   462MB
</code></pre>
<p>Starting the container fails:</p>
<pre><code>pod/library-867dfb64db-vndtj    Pulling image &quot;library:0.1.0&quot;
pod/library-867dfb64db-vndtj    Failed to pull image &quot;library:0.1.0&quot;: rpc error: code = Unknown desc = failed to pull and unpack image &quot;library:0.1.0&quot;: failed to resolve reference &quot;library:0.1.0&quot;: failed to do request: Head &quot;https://...com/v2/library/manifests/0.1.0&quot;: x509: certificate signed by unknown authority
pod/library-867dfb64db-vndtj    Error: ErrImagePull
pod/library-867dfb64db-vndtj    Error: ImagePullBackOff
pod/library-867dfb64db-vndtj    Back-off pulling image &quot;library:0.1.0&quot;
</code></pre>
<p><em><strong>How to resolve local images visibility for k3d cluster?</strong></em></p>
<hr />
<p>Solution:</p>
<p>Update the <code>Deployment.yml</code>:</p>
<pre><code>spec:
  terminationGracePeriodSeconds: 40
  containers:
    - name: 'library-xp'
      image: xpinjection/library:0.1.0
      imagePullPolicy: Never
</code></pre>
<p>And import the image to cluster:</p>
<blockquote>
<p>k3d image import xpinjection/library:0.1.0 -c mycluster</p>
</blockquote>

catch23
<p>If you don't want to use a docker registry, you have to import the locally built image into the k3d cluster:</p>
<pre><code>k3d image import [IMAGE | ARCHIVE [IMAGE | ARCHIVE...]] [flags]
</code></pre>
<p>But don't forget to configure in your deployment:</p>
<pre><code>imagePullPolicy: Never
</code></pre>
