<p>I'm using the latest version of microk8s and docker on the same VM. microk8s registry is enabled.</p>
<p>I restaged my image argus</p>
<pre><code>$ docker images
REPOSITORY              TAG                 IMAGE ID       CREATED       SIZE
argus                   0.1                 6d72b6be9981   3 hours ago   164MB
localhost:32000/argus   registry            6d72b6be9981   3 hours ago   164MB
</code></pre>
<p>then I pushed it</p>
<pre><code>$ docker push localhost:32000/argus:registry
The push refers to repository [localhost:32000/argus]
c8a05c6fda3e: Pushed 
5836f564d6a0: Pushed 
9e3dd069b4a1: Pushed 
6935b1ceeced: Pushed 
d02e8e9f8523: Pushed 
c5129c726314: Pushed 
0f299cdf8fbc: Pushed 
edaf6f6a5ef5: Pushed 
9eb034f85642: Pushed 
043895432150: Pushed 
a26398ad6d10: Pushed 
0dee9b20d8f0: Pushed 
f68ef921efae: Pushed 
registry: digest: sha256:0a0ac9e076e3249b8e144943026bc7c24ec47ce6559a4e087546e3ff3fef5c14 size: 3052
</code></pre>
<p>all working seemingly fine but when I try to deploy a pod with:</p>
<pre><code>$ microk8s kubectl create deployment argus --image=argus
deployment.apps/argus created
$ microk8s kubectl get pods
NAME                     READY   STATUS         RESTARTS   AGE
argus-84c8dcc968-27nlz   0/1     ErrImagePull   0          9s
$ microk8s kubectl logs argus-84c8dcc968-27nlz
Error from server (BadRequest): container &quot;argus&quot; in pod &quot;argus-84c8dcc968-27nlz&quot; is waiting to start: trying and failing to pull image
</code></pre>
<p>The image can not be pulled, I tried the <code>$ microk8s ctr images ls</code> but this does not tell me anything.
So what is it that I'm doing wrong here?</p>
<p><strong>update:</strong></p>
<p>A bit of an update here when I try:</p>
<pre><code>$ microk8s ctr image pull localhost:32000/argus:registry
ctr: failed to resolve reference &quot;localhost:32000/argus:registry&quot;: failed to do request: Head &quot;https://localhost:32000/v2/argus/manifests/registry&quot;: http: server gave HTTP response to HTTPS client
</code></pre>
<p>So it seems that it does not like that it gets and <code>http</code> response from my local repository. I looked into the config at <code>/var/snap/microk8s/current/args/containerd-template.toml</code> and there the <code>localhost</code> repository is correctly configured:</p>
<pre><code>  [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry]

    # 'plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors' are namespace to mirror mapping for all namespaces.
    [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors]
      [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors.&quot;docker.io&quot;]
        endpoint = [&quot;https://registry-1.docker.io&quot;, ]
      [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors.&quot;localhost:32000&quot;]
        endpoint = [&quot;http://localhost:32000&quot;]
</code></pre>
<p>I'm running all of this on a centos8 VM. When I installed docker
I needed to do it with <code>sudo dnf install docker-ce --nobest</code> because otherwise there was some kind of conflict with containerd maybe it has todo something with this?</p>

Thagor
<p>Okay, there were multiple issues at play here, and I think I solved them all. First of, I made a mistake with the Docker Image. It was a test image, but it should have had something that continuously runs because after PID 1 ends the container gets restarted, the reasons is that <code>microk8s/kubernetes</code> assumes a there is a problem. That's why there was the crash loop.</p>
<p>Second, to check which repositories are present in the local registry, it's easiest to <code>curl</code> the <code>rest API</code> of the registry with:</p>
<pre><code>$curl http://host:32000/v2/_catalog
</code></pre>
<p>to get a list of all images, and:</p>
<pre><code>$curl http://host:32000/v2/{repositoryName}/tags/list
</code></pre>
<p>to get all tags for a given repo.</p>
<p>Lastly, to pull from the registry to the cluster manually without getting the <code>https</code> error, it's necessary to add the <code>--plain-http</code> option like this:</p>
<pre><code>$microk8s ctr image pull --plain-http localhost:32000/repo:tag
</code></pre>
