Failed to pull image: failed to pull and unpack image: failed to resolve reference: failed to do request: Head : http: server gave HTTP response to HTTPS client

node에서 private registry를 활용해 컨테이너를 pull할때 생기는 오류.

 

Image를 pull하려는 노드에서 containerd 설정을 변경해줘야한다. (runtime이 containerd라고 한다면)

 

https://github.com/containerd/containerd/blob/main/docs/hosts.md#bypass-tls-verification-example

 

containerd/docs/hosts.md at main · containerd/containerd

An open and reliable container runtime. Contribute to containerd/containerd development by creating an account on GitHub.

github.com

 

위 가이드를 따라서 진행하면된다. 다만, 어떤 노드는 /etc/containerd/config.toml이 존재하지 않을수 있다. 그럴때는 아래와 같이

containerd config default > /etc/containerd/config.toml

또는 

containerd config default| sudo tee /etc/containerd/config.toml

를 해주어 config.toml을 만들어준다. 

 

가이드에도 나와 있지만

[plugins."io.containerd.grpc.v1.cri".registry]
   config_path = "/etc/containerd/certs.d"

registry 부분 아래에 config path를 설정해준다. 

이후에 private registry를 /etc/containerd/cert.d 폴더 아래에 만들어주면 된다. 

예를 들어, 내 private registry가 192.168.0.1:5000 이라고 한다면,

/etc/containerd/cert.d/192.168.0.1:5000/hosts.toml에 아래와 같이 toml파일을 작성해주면 된다.

server = "http://192.168.0.1:5000"

[host."http://192.168.0.1:5000"]
  capabilities = ["pull", "resolve", "push"]
  skip_verify = true

 

그러면 정상적으로 kubernetes pod 내에서 image를 pull하는 것을 볼수 있다.