@@ -186,7 +186,11 @@ function install_crun_runtime {
186186 echo -e " \\ 033[32m---> crun runtime install completed!\\ 033[0m"
187187}
188188
189- # install_kata_runtime downloads and installs the Kata Containers runtime for VM-based isolation.
189+ # install_kata_runtime downloads and installs the Kata Containers runtime with Dragonball VMM.
190+ # The Dragonball configuration is used instead of the default QEMU, providing lower
191+ # memory overhead (~130Mi vs 160Mi) and faster startup (~100ms vs 500ms).
192+ # sandbox_cgroup_only is set to true for complete resource tracking and cgroups v2 support.
193+ # Requires PodOverhead configured in the RuntimeClass (see install_k3s_server).
190194function install_kata_runtime {
191195 echo -e " \\ 033[32m---> Start install kata runtime\\ 033[0m"
192196 if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
@@ -201,6 +205,10 @@ function install_kata_runtime {
201205
202206 curl -fL " ${kata_download_url} " -o ${kata_package}
203207 tar -I zstd -xf ${kata_package} -C /
208+ cp /opt/kata/share/defaults/kata-containers/configuration-dragonball.toml \
209+ /opt/kata/share/defaults/kata-containers/configuration.toml
210+ sed -i s/sandbox_cgroup_only=false/sandbox_cgroup_only=true/g \
211+ /opt/kata/share/defaults/kata-containers/configuration.toml
204212 ln -sf /opt/kata/bin/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
205213 ln -sf /opt/kata/bin/kata-collect-data.sh /usr/local/bin/kata-collect-data.sh
206214 ln -sf /opt/kata/bin/kata-runtime /usr/local/bin/kata-runtime
231239 do
232240 if [[ " ${containerd_runtimes[n]} " == " kata" ]]; then
233241 install_kata_runtime
234- sed -i s/sandbox_cgroup_only=false/sandbox_cgroup_only=true/g /opt/kata/share/defaults/kata-containers/configuration.toml
235242 cat << EOF >> "${CONTAINERD_CONFIG_FILE} "
236243[plugins.cri.containerd.runtimes.kata]
237244 runtime_type = "io.containerd.kata.v2"
@@ -324,6 +331,8 @@ function configure_k3s_mirrors {
324331# install_k3s_server installs and bootstraps a k3s server (control plane) node.
325332# Configures OS, runtimes, kubectl, registry mirrors, then installs k3s with
326333# embedded registry, Cilium CNI, and registers RuntimeClass resources.
334+ # For Kata runtime, PodOverhead is configured (130Mi memory, 250m CPU)
335+ # to enable sandbox_cgroup_only=true with Dragonball VMM.
327336function install_k3s_server {
328337 configure_os
329338 install_runtime
@@ -342,13 +351,27 @@ function install_k3s_server {
342351 readarray -d , -t containerd_runtimes <<< " $CONTAINERD_RUNTIMES"
343352 for (( n= 0 ; n < ${# containerd_runtimes[*]} ; n++ ))
344353 do
345- kubectl apply -f - << EOF
354+ if [[ " ${containerd_runtimes[n]} " == " kata" ]]; then
355+ kubectl apply -f - << EOF
346356apiVersion: node.k8s.io/v1
347357kind: RuntimeClass
348358metadata:
349359 name: ${containerd_runtimes[n]}
350360handler: ${containerd_runtimes[n]}
361+ overhead:
362+ podFixed:
363+ memory: "130Mi"
364+ cpu: "250m"
351365EOF
366+ else
367+ kubectl apply -f - << EOF
368+ apiVersion: node.k8s.io/v1
369+ kind: RuntimeClass
370+ metadata:
371+ name: ${containerd_runtimes[n]}
372+ handler: ${containerd_runtimes[n]}
373+ EOF
374+ fi
352375 done
353376}
354377
0 commit comments