환경
- Ubuntu 22.04.3 TLS
- Kubernetes 1.28.2
- Containerd 1.26.0
- Crictl 1.26.0
증상
- crictl 명령어 사용 시 아래와 같은 에러 메시지와 함께 실행 불가
WARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.
WARN[0000] image connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.
E0214 06:30:26.114803 1106869 remote_runtime.go:390] "ListContainers with filter from runtime service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory\"" filter="&ContainerFilter{Id:,State:&ContainerStateValue{State:CONTAINER_RUNNING,},PodSandboxId:,LabelSelector:map[string]string{},}"
FATA[0000] listing containers: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"
원인
- Kubernetes에서 crictl로 호출하는 컨테이너 런타임의 Endpoint가 /var/run/dockershim.sock으로 설정되어 있음
- 그러나 Kubernetes 1.24 버전부터는 Dockershim에 대한 지원이 중단된 상태(관련 내용 링크)
조치 (1)
- crictl 명령어 옵션을 통해 runtime endpoint와 image endpoint를 수동으로 지정
sudo crictl -r unix:///run/containerd/containerd.sock -i unix:///run/containerd/containerd.sock ps
- 단, 해당 옵션은 일회성으로 지속성이 없음
조치 (2)
- crictl config 명령어를 사용하여 runtime endpoint와 image endpoint를 설정
sudo crictl config --set runtime-endpoint=unix:///run/containerd/containerd.sock --set image-endpoint=unix:///run/containerd/containerd.sock
# runtime endpoint와 image endpoint를 영구적으로 설정하는 명령어
sudo crictl ps
- 위 명령어를 실행하고 나면 /etc/crictl.yaml 파일이 생성되며 내용은 아래와 같음
runtime-endpoint: "unix:///run/containerd/containerd.sock"
image-endpoint: "unix:///run/containerd/containerd.sock"
timeout: 0
debug: false
pull-image-on-create: false
disable-pull-on-run: false
추가
- crictl은 Kubernetes에서 제공하는 컨테이너 런타임 제어 명령
- CRI(Container Runtime Interface) 규격을 만족하는 컨테이너 런타임에 대하여 제어가 가능
- 단, crictl은 컨테이너 런타임 레벨에서의 Debug 용도로 사용하는 것을 권장
- 이미 Kubernetes 1.24 버전에서 지원이 중단된 dockershim이 아직도 crictl의 runtime endpoint로 지정되어 있는 이유에 대해서는 더욱 스터디가 필요
'Study > Troubleshooting' 카테고리의 다른 글
[Ubuntu 22.04] 0% Waiting for headers - 해결됨 (0) | 2025.02.16 |
---|---|
[Prometheus] Target 비활성화 문제 - 해결 (4) | 2023.10.22 |
[Kubernetes] Service Account와 Secret 생성 - 해결 (0) | 2023.09.17 |
[Ansible] kubectl 명령어 실행 문제 - 해결 (1) | 2023.08.15 |