<p>I followed this <a href="https://stackoverflow.com/questions/51893120/kubernetes-pull-from-insecure-docker-registry">link</a> and created a secret as below.</p>
<pre><code>kubectl create secret docker-registry regsec --docker-server=192.168.56.106:5000 --docker-username=osboxes --docker-password=osboxes.org --insecure-skip-tls-verify=true
</code></pre>
<p>And the deployment as below.</p>
<pre><code>kubectl create deploy nginx1 --image 192.168.56.106:5000/todoapp:1.0
</code></pre>
<p>And edited it using</p>
<pre><code>kubectl edit deploy nginx1
</code></pre>
<p>And added imagePullSecrets to it</p>
<pre><code># Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: &quot;2&quot;
  creationTimestamp: &quot;2021-07-21T10:23:23Z&quot;
  generation: 2
  labels:
    app: nginx1
  name: nginx1
  namespace: default
  resourceVersion: &quot;6872&quot;
  uid: 0b6917f0-10ac-4206-82a8-c49ae8ffa2b3
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx1
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx1
    spec:
      containers:
      - image: 192.168.56.106:5000/todoapp:1.0
        imagePullPolicy: IfNotPresent
        name: todoapp
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: regsec
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  conditions:
  - lastTransitionTime: &quot;2021-07-21T10:23:23Z&quot;
    lastUpdateTime: &quot;2021-07-21T10:23:23Z&quot;
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: &quot;False&quot;
    type: Available
  - lastTransitionTime: &quot;2021-07-21T10:23:23Z&quot;
    lastUpdateTime: &quot;2021-07-21T10:28:36Z&quot;
    message: ReplicaSet &quot;nginx1-75df7fd466&quot; is progressing.
    reason: ReplicaSetUpdated
    status: &quot;True&quot;
    type: Progressing
  observedGeneration: 2
  replicas: 2
  unavailableReplicas: 2
  updatedReplicas: 1
</code></pre>
<p>But still getting below error.</p>
<pre><code>osboxes@osboxes:~/Desktop$ kubectl get pods
    NAME                      READY   STATUS             RESTARTS   AGE
    nginx-6799fc88d8-vvzjf    1/1     Running            0          19m
    nginx1-65d848d94f-dd4ck   0/1     ImagePullBackOff   0          12m
    nginx1-75df7fd466-kn5mf   0/1     ImagePullBackOff   0          6m50s

osboxes@osboxes:~/Desktop$ kubectl describe pod nginx1-75df7fd466-kn5mf
Name:         nginx1-75df7fd466-kn5mf
Namespace:    default
Priority:     0
Node:         samples-control-plane/172.19.0.3
Start Time:   Wed, 21 Jul 2021 06:28:36 -0400
Labels:       app=nginx1
              pod-template-hash=75df7fd466
Annotations:  &lt;none&gt;
Status:       Pending
IP:           10.244.0.8
IPs:
  IP:           10.244.0.8
Controlled By:  ReplicaSet/nginx1-75df7fd466
Containers:
  todoapp:
    Container ID:
    Image:          192.168.56.106:5000/todoapp:1.0
    Image ID:
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-88clq (ro)
Conditions:

  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-88clq:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  73s                default-scheduler  Successfully assigned default/nginx1-75df7fd466-kn5mf to samples-control-plane
  Normal   Pulling    33s (x3 over 73s)  kubelet            Pulling image &quot;192.168.56.106:5000/todoapp:1.0&quot;
  Warning  Failed     33s (x3 over 73s)  kubelet            Failed to pull image &quot;192.168.56.106:5000/todoapp:1.0&quot;: rpc error: code = Unknown desc = failed to pull and unpack image &quot;192.168.56.106:5000/todoapp:1.0&quot;: failed to resolve reference &quot;192.168.56.106:5000/todoapp:1.0&quot;: failed to do request: Head &quot;https://192.168.56.106:5000/v2/todoapp/manifests/1.0&quot;: http: server gave HTTP response to HTTPS client
  Warning  Failed     33s (x3 over 73s)  kubelet            Error: ErrImagePull
  Normal   BackOff    6s (x4 over 72s)   kubelet            Back-off pulling image &quot;192.168.56.106:5000/todoapp:1.0&quot;
  Warning  Failed     6s (x4 over 72s)   kubelet            Error: ImagePullBackOff
</code></pre>
<p>kubectl version</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.1&quot;, GitCommit:&quot;5e58841cce77d4bc13713ad2b91fa0d961e69192&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-05-13T02:40:46Z&quot;, GoVersion:&quot;go1.16.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.1&quot;, GitCommit:&quot;5e58841cce77d4bc13713ad2b91fa0d961e69192&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-05-21T23:01:33Z&quot;, GoVersion:&quot;go1.16.4&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
</code></pre>
<p>Adding docker insecure registry is not useful as the container runtime is not docker now.It is containerd.</p>
<p>/etc/default/docker.json</p>
<p>And for reference, I have setup the local container on a virtualbox VM and connecting to kubernetes on the same network using Host-only network ip address.</p>
<p>The setup of local registry is created using the steps mentioned in <a href="https://www.exoscale.com/syslog/setup-private-docker-registry/" rel="nofollow noreferrer">link</a>.</p>
<p>And the kubernetes was setup using <a href="https://linuxdiaryblog.blogspot.com/2021/07/deploy-kubernetes-inside-docker-using.html" rel="nofollow noreferrer">kind</a>.</p>

uday
<h4 id="cri-o-erxz">cri-o</h4>
<p>If you are using <code>cri-o</code> as Container Runtime Provider, docker settings are of no use. You would require to configure <code>cri-o</code> instead: <a href="https://github.com/cri-o/cri-o#configuration" rel="nofollow noreferrer">https://github.com/cri-o/cri-o#configuration</a></p>
<p>Assuming you have <code>cri-o</code> installed on the host node, the official documentation recommends to have a <code>$HOME/.config/containers/registries.conf</code> file, or a global, <code>/etc/containers/registries.conf</code> file to configure registries in a runtime engine agnostic way.</p>
<p>The file structure spec is also documented: <a href="https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md" rel="nofollow noreferrer">https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md</a></p>
<p>Example:</p>
<pre><code>[registries.search]
registries = ['registry1.com', 'registry2.com']

[registries.insecure]
registries = ['registry3.com']

[registries.block]
registries = ['registry.untrusted.com', 'registry.unsafe.com']
</code></pre>
<h4 id="containerd-verm">containerd</h4>
<p><code>Containerd</code> does not seem to acknowledge the <code>/etc/containers/registries.conf</code> settings.</p>
<p>As per <a href="https://github.com/containerd/containerd/blob/main/docs/hosts.md" rel="nofollow noreferrer">the documentation</a>, The main config file <code>/etc/containerd/config.toml</code> can specify a registry config path as:</p>
<pre><code>[plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry]
   config_path = &quot;/etc/containerd/certs.d&quot;
</code></pre>
<p>And inside the path specified above (<code>/etc/containerd/certs.d</code>) create a directory for host (<code>docker.io</code>) and in it, create a <code>hosts.toml</code> file. That is <code>/etc/containerd/certs.d/docker.io/hosts.toml</code>:</p>
<pre><code>server = &quot;https://registry-1.docker.io&quot;

[host.&quot;http://my-custom-registry:5000&quot;]
  capabilities = [&quot;pull&quot;, &quot;resolve&quot;, &quot;push&quot;]
  skip_verify = true
  plain-http = true
</code></pre>
<p>For <code>my-custom-registry:5000</code> section you can also provide credentials as well as certificates.</p>
<p>And restart <code>containerd</code> daemon/service on the host.</p>
<p>Configuration file spec is here: <a href="https://github.com/containerd/containerd/blob/main/docs/hosts.md" rel="nofollow noreferrer">https://github.com/containerd/containerd/blob/main/docs/hosts.md</a></p>
