#1. kata v3 + QEMU 기반으로 직접 설치해보기

순수 Ubuntu 만 설치되어 있는 Host 환경에서, 직접 v3 기반의 kata container 와 containerd 설치를 통해 Micro VM 기반의 Container를 직접 생성해본다.
1-0 :: 목표 및 실습 환경
목표
- kata runtime 3.0을 "Host"에 직접 설치하기
- 그리고 MicroVM을 생성하기 위해 VMM으로 QEMU 사용(연동)하기
- (즉, 이번 실습에서, kata v3의 가장 큰 특징 중 하나인 Dragonball 을 사용하지 않고 기존 QEMU 기반으로 실습)
설치 방식
- 현재('25.08) 아래 링크를 보면, rust 기반인 3.x 설치의 경우 Source를 통해 직접 설치만 가능하다.
- kata-containers/docs/install/kata-containers-3.0-rust-runtime-installation-guide.md at main · kata-containers/kata-containers · GitHub
실습 환경
- 참고로 아래 실습은 ubuntu noble (24.04) 기반으로 진행.
1-1 :: 사전 패키지 설치 및 설정
kata runtime 을 설치 하기 전, QEMU
와 같이 필요한 사전 패키지를 설치한다.
(아래 진행은 ubuntu noble 기준으로 진행)
sudo apt update
sudo apt install -y \
qemu-system-x86 \
qemu-utils \
virtiofsd
virtiofsd
의 경우 noble 부터, qemu 설치 이후에도 별도 설치를 해주어야 한다.- 정상 설치가 되었는지 확인
qemu-system-x86_64 --version
dpkg -L virtiofsd | grep virtiofsd
app armor 비 활성화
- 실습상 편의를 위해, app-armor는 비활성화한다.
- (단, 준비된 환경의 OS Verison 에 따라 다를 수 있음)
sudo rm -rf /etc/apparmor.d/*
sudo systemctl stop apparmor
sudo systemctl disable apparmor
# sudo vi /etc/default/grub
# ...
# 아래와 같이 apparmor=0 추가
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=0"
# ...
sudo update-grub
sudo reboot now
1-2 :: Rust 환경 준비
v3에서는 kata의 runtime이 go
가 아닌 rust
기반으로 작성 되었기에, 우선 rust
가 실행 가능한 환경을 setup 한다.
rust
Version 설정
export RUST_VERSION=1.85.1
Rustup
다운로드 및 rust
설치
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 이후 shell 내 1 입력
source $HOME/.cargo/env
rustup install ${RUST_VERSION}
rustup default ${RUST_VERSION}-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl
표준 라이브러리 (Musl
, libc
) 설치
wget https://musl.libc.org/releases/musl-1.2.3.tar.gz
tar vxf musl-1.2.3.tar.gz
cd musl-1.2.3/
./configure --prefix=/usr/local/
make && sudo make install
1-3 :: kata runtime 설치
이전 rust
환경 준비가 끝났으면, 이제 본격적으로 kata runtime을 설치 할 차례이다.
우선 git을 통해서 Code 를 가져온다.
git clone https://github.com/kata-containers/kata-containers.git
이후 make install
을 진행하는데, v3
기본인 Dragonball VMM
을 사용하지 않고, 기존 QEMU
기반으로 연동 하기 위해 아래와 같이 추가 옵션을 설정한 뒤 진행한다.
cd kata-containers/src/runtime-rs
# Build
make USE_BUILDIN_DB=false
# Install
make install HYPERVISOR=qemu
설치 시 아래와 같은 콘솔 출력을 확인할 수 있다.

1-4 :: kata runtime 정상 설치 확인
이제 kata runtime 이 정상적으로 설치 되었는 지 확인하자.
which containerd-shim-kata-v2
# /usr/local/bin/containerd-shim-kata-v2
containerd-shim-kata-v2 --version
# Kata Containers containerd shim (Rust): id: io.containerd.kata.v2, version: 3.19.1, commit: c92bb1aa88fa75005524575de3d192fe747dd3e7
- 참고로 v3 (Rust) 기반이여도, 이름은
containerd-shim-kata-v2
이다. v2
의 의미는containerd
의v2
인터페이스를 준수한다는 의미이다.
1-5 :: MicroVM 생성을 위한 Kernel & Image 다운로드 및 설정
kata 기반으로 Container Process 를 실행하기 위해, 기반이 되는 Micro VM이 사용할 커널과 OS Image가 필요하다.
이를 위해 직접 Kernerl 과 Image & rootfs 를 제작할 수도 있고, 이미 생성된 것을 사용할 수도 있다. (직접 제작을 위해서는 kata-container 내 docs 를 참고하면 된다)
해당 실습에서는 사전에 제작된 kernel과 image를 다운로드 받은 뒤, runtime이 사용할 수 있게 설정하는 방식으로 진행한다.
다운로드 받을 커널과 이미지는 아래 링크의 Assets
부분에서 확인 할 수 있다.
- Releases · kata-containers/kata-containers > kata-static-3.19.1-amd64.tar.xz
cd ~
# 다운로드
wget https://github.com/kata-containers/kata-containers/releases/download/3.19.1/kata-static-3.19.1-amd64.tar.xz
# 압축 해제
tar -xf kata-static-3.19.1-amd64.tar.xz
이후 압축 해제 된 디렉터리에 들어가면, 아래와 같이 필요한 커널과 이미지를 확인할 수 있다.
# 파일 확인
cd ~/opt/kata/share/kata-containers
tree .
.
# ...
├── kata-ubuntu-noble.image
├── kata-ubuntu-noble-nvidia-gpu-575.64.03.initrd
├── kata-ubuntu-noble-nvidia-gpu-confidential-575.64.03.initrd
├── root_hash.txt
├── vmlinux-6.12.36-160
├── vmlinux-6.12.36-160-confidential
# ...
- 커널 :
vmlinux-6.12.36-160
- Image :
kata-ubuntu-noble.image
다운 받은 위 파일들을, kata runtime이 사용할 수 있도록 하기 위해 아래와 같은 (기본) 경로로 복사한다.
mkdir -p /usr/share/kata-containers/
# kernel
cp ~/opt/kata/share/kata-containers/vmlinux-6.12.36-160 \
/usr/share/kata-containers/vmlinux.container
# image
cp ~/opt/kata/share/kata-containers/kata-ubuntu-noble.image \
/usr/share/kata-containers/kata-containers.img
잘 복사 되었는지 확인.
# 확인
ls -alh /usr/share/kata-containers/
total 521M
drwxr-xr-x 2 root root 4.0K Aug 19 00:44 .
drwxr-xr-x 148 root root 4.0K Aug 19 00:44 ..
-rw-r--r-- 1 root root 256M Aug 19 00:44 kata-containers.img
-rw-r--r-- 1 root root 265M Aug 19 00:44 vmlinux.container
이후 kata-runtime의 설정을 위해 configuration.toml
을 생성한다.
mkdir -p /etc/kata-containers
cp -f /usr/share/defaults/kata-containers/runtime-rs/configuration-qemu-runtime-rs.toml /etc/kata-containers/configuration.toml
그리고 qemu를 통해 Mirco VM을 생성하기 위한 QEMU, 커널, 이미지 경로가 제대로 구성 되어 있는 지 확인 및 수정한다.
# vim /etc/kata-containers/configuration.toml
[hypervisor.qemu]
path = "/usr/bin/qemu-system-x86_64"
kernel = "/usr/share/kata-containers/vmlinux.container"
image = "/usr/share/kata-containers/kata-containers.img"
ls -alh /usr/share/kata-containers/
내 실제 파일과 비교하면서 정상적으로 설정되었는지 검토.
1-6 :: Containerd 설치
kata-runtime 설치가 완료되었으므로, 이어서 해당 runtime을 제어 할 Containerd 설치를 진행한다.
cd ~
wget https://github.com/containerd/containerd/releases/download/v1.7.28/containerd-1.7.28-linux-amd64.tar.gz
tar Cxzvf /usr/local containerd-1.7.28-linux-amd64.tar.gz
- Containerd
1.7.28
버전 사용
설치 이후에, Containerd를 위한 systemd
Service 파일을 다운 받은 뒤 활성화(enable & start) 한다.
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
cp containerd.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl enable containerd
systemctl start containerd
- 이후
systemctl status containerd
통해서 정상적으로 실행되었는 지 확인한다.
1-7 :: Containerd - kata runtime 설정
Containerd를 설치하였으니, 이제 Containerd가 Runtime으로 kata
를 사용할 수 있도록 설정을 진행한다.
먼저 Containerd 설정 파일을 추출한다. (혹시 이미 존재한다면 생략)
mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null
그리고 kata runtime 과 호환을 위해 아래와 같이 Containerd 내 설정을 진행한다.
# vim /etc/containerd/config.toml
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
[plugins."io.containerd.grpc.v1.cri".containerd]
default_runtime_name = "kata"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.kata]
runtime_type = "io.containerd.kata.v2"

이후 containerd를 재시작한다.
systemctl daemon-reload
systemctl restart containerd
1-8 :: Containerd 를 통해 kata 기반의 Container 생성해보기
여기까지 진행했다면, kata runtime 설치와 이를 제어 할 Containerd를 모두 설치하였으니 실제 생성을 해보자.
테스트에 사용할 Container의 Image는 nginx
를 사용한다.
ctr image pull docker.io/library/nginx:latest
ctr run --runtime "io.containerd.kata.v2" \
--d docker.io/library/nginx:latest \
test-kata-nginx
--runtime "io.containerd.kata.v2"
지정하는 것을 확인하자.
이후 Container가 정상적으로 생성 되었는지 확인해보자.
ctr c list
# ---
CONTAINER IMAGE RUNTIME
test-kata-nginx docker.io/library/nginx:latest io.containerd.kata.v2
정상 생성 되었다면 Container 안에 들어가서 nginx
가 맞는 지 확인하자.
ctr t exec --exec-id test -t test-kata-nginx /bin/sh
cat /usr/share/nginx/html/index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
# ...
nginx
Container가 정상적으로 생성되었음을 알 수 있다.
단, 별도의 Container Network 작업은 되어 있지 않은 상태라, :80
통해서 nginx 서비스 등은 불가능한 상태다.
(이는 #2. 에서 k8s 구성 이후 수행)
Host에서 Process 조회 해보기
ps aux
- 아래 결과를 보면 알 수 있듯이,
nginx
Container Process 를 위한, Micro VM이 qemu로 실행되었음을 알 수 있다.
root 15502 0.2 0.2 70700 23552 ? Sl 00:49 0:00 /usr/local/bin/containerd-shim-kata-v2 -id test-kata-nginx -namespace default -address /run/containerd/containerd.sock -publish-binary /usr/local/bin/containerd
root 15508 0.0 0.2 2306624 17280 ? Sl 00:49 0:00 /usr/libexec/virtiofsd --socket-path virtiofsd.sock --shared-dir /run/kata-containers/shared/sandboxes/test-kata-nginx/ro --cache auto --sandbox none --seccomp none --thread-pool-size=1 -o announce_submounts
root 15512 1.4 2.5 2939816 201240 ? Sl 00:49 0:02 /usr/bin/qemu-system-x86_64 -name sandbox-test-kata-nginx -kernel /usr/share/kata-containers/vmlinux.container -append reboot=k panic=1 systemd.unit=kata-containers.target systemd.mask=systemd-networkd.service root=/dev/pmem0p1 rootf
이어서... https://aoc55.tistory.com/73
'Cloud > kubernetes (k8s)' 카테고리의 다른 글
k8s :: k8s Security - 10 Best Practices (0) | 2025.10.02 |
---|---|
k8s :: kata container (v3) 설치 해보기 with k8s - #2 (0) | 2025.08.20 |
IT서적후기 :: 쿠버네티스 오퍼레이터 (8) | 2024.09.04 |
쿠버네티스 :: GCP(VM)에 kubernetes Cluster 직접 구축하기 - 3 (23.01 수정) (3) | 2022.03.12 |
쿠버네티스 :: GCP(VM)에 kubernetes Cluster 직접 구축하기 - 2 (23.01 수정) (0) | 2022.03.12 |