homek8s/apps/base/forgejo/kata-runtimeclass.yaml
Sirius DevOps 989a0997fb feat(ci-runners): run the deploy runner in a Kata microVM (staged)
The CI capsule cannot enforce PSA baseline: every nested dockerd needs
SYS_ADMIN+NET_ADMIN in the pod spec and baseline forbids exactly those, which
sysbox, gVisor and Kata all reproduce (measured on both arches, card
t_8aa4af50). What a runtime CAN change is what privileged:true means.

Stage 1, one runner: forgejo-runner-deploy-arm64 (rpi) gets
runtimeClassName: kata-qemu, so its privileged dind and job containers run
inside a QEMU/KVM microVM instead of on rpi's host namespaces. The amd64 and
shared arm64 runners stay on privileged dind under runc, untouched.

Kata-specific plumbing in the same Deployment:
- loop-backed ext4 data-root (16GiB image on the existing claim) because
  overlayfs refuses virtiofs and Docker would silently fall back to vfs;
- binfmt_misc + tonistiigi/binfmt --install amd64 on every start, because the
  guest kernel has no qemu handlers and deploy-site.yml cross-builds amd64;
- the runner waits for /var/run/dind-ready (touched after both are set up).

RuntimeClass kata-qemu is cluster-scoped; the containerd handler lives on rpi
only (/etc/containerd/conf.d/50-kata.toml, kata-static 4.4.0). Rollback is one
field. docs/pod-security.md records the measurement and states plainly that the
namespace stays enforce: privileged.
2026-11-27 02:08:47 -05:00

27 lines
1.2 KiB
YAML

---
# Kata Containers microVM RuntimeClass for the CI capsule (card t_8aa4af50).
#
# What this buys and what it does NOT: a pod using this class still declares
# `privileged: true` — a nested dockerd needs CAP_SYS_ADMIN + CAP_NET_ADMIN in
# the pod spec, and PSA `baseline` forbids exactly those two, so `ci-runners`
# stays at `enforce: privileged` (docs/pod-security.md). What changes is what
# privilege applies to: the container runs inside a QEMU/KVM microVM, so
# "privileged" means root in a VM with no host namespaces, no host kernel and
# only the volumes the pod mounts — an escape has to beat KVM first.
#
# The handler name `kata-qemu` must exist in containerd on every node that can
# run a pod with this class (drop-in /etc/containerd/conf.d/50-kata.toml,
# kata-static 4.4.0 under /opt/kata). Installed on rpi 2026-11-27; not yet on
# siriussec — that is why only the rpi-pinned deploy runner uses this class.
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: kata-qemu
handler: kata-qemu
# VM overhead is charged to the pod so the scheduler accounts for it. The VM
# itself is sized from the pod's memory limits (2Gi here) plus the kata
# agent/kernel.
overhead:
podFixed:
cpu: 250m
memory: 160Mi