쿠버네티스 ImagePullBackOff
쿠버네티스에서 ImagePullBackOff 오류가 발생하였다. 이용 중인 서비스는 Harbor로 해당 컨테이너에서 다른 이미지를 pull 권한을 갖고 있어야 동작하는 pod 서비스이다.
kubectl get pods -A 명령어로 ImagePullBackOff 상세 오류를 확인할 수 있다.
쿠버네티스에서 권한 오류로 발생 사항은 describe 에서 자세히 살펴볼 수 있다.
kubectl describe pods -n {namespace} {pod-number} 입력하여 자세히 살펴보자.
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Failed 56m (x33 over 3h26m) kubelet Failed to pull image "harbor.kiioio.com/portal/batch:cea6705": failed to pull and unpack image "harbor.kiioio.com/portal/batch:cea6705": failed to resolve image: failed to do request: Head "https://harbor.kiioio.com/v2/portal/batch/manifests/cea6705": tls: failed to verify certificate: x509: certificate is valid for ingress.local, not harbor.kiioio.com
Normal BackOff 2m22s (x903 over 3h26m) kubelet Back-off pulling image "harbor.kiioio.com/portal/batch:cea6705"
Warning Failed 99s (x906 over 3h26m) kubelet Error: ImagePullBackOffimage를 pulling 하였더니 tls 검증 문제로 실패하였다는 오류메세지 문구를 확인할 수 있다.
이 경우 쿠버네티스의 TLS 문제로 확인되므로 Image Pulling를 실행하는 워커노드에서 Containerd의 TLS 인증서 경로 및 Image Pulling 에는 TLS 생략하도록 설정하였다.
config.toml
``` 변경 전
[plugins.'io.containerd.cri.v1.images'.registry]
config_path = '/etc/containerd/certs.d:/etc/docker/certs.d'
```
``` 변경 후
[plugins.'io.containerd.cri.v1.images'.registry]
config_path = '/etc/containerd/certs.d'
```hosts.toml
ssh kiioio-worker03
cat << EOF > /etc/containerd/certs.d/harbor.kiioio.com/hosts.toml
server = "https://harbor.kiioio.com"
[host."https://harbor.kiioio.com"]
skip_verify = true
EOF
systemctl restart containerd
systemctl restart kubelet이와 같이 오류를 확인하고 조치를 해주도록 한다. 아직도 발생한다면 Authorization 인 것으로 파악되었다면 Authorization 관련 설정들을 살펴봐야한다.