<p>I setup kubernetes V1.20.1 with <code>containerd</code> instead of Docker. Now I failed to pull Docker images from my private registry (Harbor).</p>
<p>I already changed the /etc/containerd/config.toml like this:</p>
<pre><code>[plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry]
  [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;registry.foo.com&quot;]
      endpoint = [&quot;https://registry.foo.com&quot;]
  [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.configs]
    [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.configs.&quot;registry.foo.com&quot;]
      [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.configs.&quot;registry.foo.com&quot;.auth]
        username = &quot;admin&quot;
        password = &quot;Harbor12345&quot;
</code></pre>
<p>But this did not work. The pull failed with the message:</p>
<pre><code>Failed to pull image &quot;registry.foo.com/library/myimage:latest&quot;: rpc error: code = Unknown
desc = failed to pull and unpack image &quot;registry.foo.com/library/myimage:latest&quot;: failed to 
resolve reference &quot;registry.foo.com/library/myimage:latest&quot;: unexpected status code 
[manifests latest]: 401 Unauthorized
</code></pre>
<p>My Harbor registry is available via HTTPS with a Let's Encrypt certificate. So https should not be the problem here.</p>
<p>Even if I try to create a docker-secret this did not work:</p>
<pre><code>kubectl create secret docker-registry registry.foo.com --docker-server=https://registry.foo.com --docker-username=admin --docker-password=Harbor12345 --docker-email=info@foo.com
</code></pre>
<p>Can anybody give me an example how to configure a private registry in Kubernetes with containerd?</p>

<p>Set <code>imagePullSecrets</code> in the pod/deployment specification:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: &lt;your-private-image&gt;
  imagePullSecrets:
  - name: registry.foo.com
</code></pre>
<p>More info: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/</a></p>
