Pull Image frrom insecure registry for K8S using containerd

253 Views Asked by At

I am unable to pull image from insecure registry using containerd.

Error:

[eds@rnd-4 4px]$ sudo crictl -r /run/containerd/containerd.sock pull <registry-name>:5000/registry/nginx:master
I1017 12:50:24.350420  117881 util_unix.go:103] "Using this endpoint is deprecated, please consider using full URL format" endpoint="/run/containerd/containerd.sock" URL="unix:///run/containerd/containerd.sock"
E1017 12:50:24.451682  117881 remote_image.go:171] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"<registry-name>:5000/registry/nginx:master\": failed to resolve reference \"<registry-name>:5000/registry/nginx:master\": failed to do request: Head \"https://registry.registry.com:5000/v2/registry/nginx/manifests/master\": http: server gave HTTP response to HTTPS client" image="<registry-name>:5000/registry/nginx:master"
FATA[0000] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "<registry-name>:5000/registry/nginx:master": failed to resolve reference "<registry-name>:5000/registry/nginx:master": failed to do request: Head "https://<registry-name>:5000/v2/registry/nginx/manifests/master": http: server gave HTTP response to HTTPS client

ERROR during image pull by yaml file:

 Normal   Pulling    52s (x4 over 2m22s)  kubelet            Pulling image "<registry-name>:5000/registry/nginx:master"
  Warning  Failed     52s (x4 over 2m22s)  kubelet            Failed to pull image "<regisitry-name>:5000/registry/nginx:master": rpc error: code = Unknown desc = failed to pull and unpack image "<regisitry-name>:5000/registry/nginx:master": failed to resolve reference "<regisitry-name>:5000/registry/nginx:master": failed to do request: Head "https://<registry-name>:5000/v2/registry/nginx/manifests/master": http: server gave HTTP response to HTTPS client

Config: cat /etc/containerd/config.toml, I change config to below and restarted the containerd, but still gettting above error.

      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = ["https://registry-1.docker.io"]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."test.http-registry.io"]
          endpoint = ["http://<registry name>:5000"]
        [plugins."io.containerd.grpc.v1.cri".registry.configs]
          [plugins."io.containerd.grpc.v1.cri".registry.configs."test.http-registry.io".tls]
            insecure_skip_verify = true

Using docker pull , Its working but for K8S using containerd its not working.

Ref link: https://github.com/containerd/cri/issues/1201

Adding insecure registry in containerd

0

There are 0 best solutions below