쿠버네티스 1.20부터 도커를 컨테이너 런타임으로 사용하는 것이 중지되었는데, 도커가 k8s CRI(Container Runtime Interface)를 지원하지 않기 때문이었습니다. 따라서 중간에 dockershim(도커심)을 어거지로 끼워서 사용은 가능했습니다.

하지만 1.24 버전부터는 dockershim도 지원이 중단됐는데요, 이때부터는 쿠버네티스 CRI와 호환되는 컨테이너 런타임을 사용해야 합니다. 예를 들면 containerd가 있습니다

 

sudo yum install containerd.io -y
sudo systemctl daemon-reload
sudo systemctl enable --now containerd
[WARNING CRI]: container runtime is not running: output: time="2022-08-12T14:58:08Z" level=fatal msg="unable to determine runtime API version: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/containerd/containerd.sock: connect: no such file or directory\""

(rockylinux8 기준)

아무튼 위 이유로 containerd를 설치하고 서비스 enable까지 했는데 컨테이너 런타임이 실행중이 아니라는 소리가 나옵니다.

원인은 containerd의 설정을 보면 cri 플러그인이 기본적으로 비활성화 되어 있기 때문입니다. (왜일까요 헷갈리게;)

#   Copyright 2018-2022 Docker Inc.

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

disabled_plugins = ["cri"]

#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0

#[grpc]
#  address = "/run/containerd/containerd.sock"
#  uid = 0
#  gid = 0

#[debug]
#  address = "/run/containerd/debug.sock"
#  uid = 0
#  gid = 0
#  level = "info"

/etc/containerd/config.toml 을 열어보면 위와 같습니다.

이 파일을 직접 열어서 저 줄을 지우거나 주석처리를 하면 되는데,

sed -i '/"cri"/ s/^/#/' /etc/containerd/config.toml

스크립트 등에서는 이렇게 sed 쓰면 됩니다.

아니면 그냥 설정파일을 지워버리거나, 'containerd config default > /etc/containerd/config.toml' 후

# vi /etc/containerd/config.toml
..
        [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime.options]
          SystemdCgroup = true
..

위 내용을 추가합니다

sed -i '/plugins."io.containerd.grpc.v1.cri".containerd.default_runtime.options/a\          SystemdCgroup = true' /etc/containerd/config.toml

sed로는 위처럼 쓰면 됩니다

 

참고

반응형