Kata Containers run workloads inside lightweight VMs, providing hardware-level isolation while keeping the container UX. Each container gets its own kernel, so a guest exploit cannot reach the host.
When you set runtime: kata on a deployment, the Stacker agent:
- Verifies the target host has
kata-runtimeinstalled and/dev/kvmaccessible. - Injects
runtime: katainto the generateddocker-compose.ymlservice definitions. - Validates compose YAML — warns if
network_mode: hostis detected (unsupported under Kata). - Deploys the stack normally via Docker Compose.
On the Stacker server side:
- The
runtimefield is validated (runcorkata) — unknown values are rejected with HTTP 422. - Agent capabilities are checked — if the target agent doesn't report
katain its/capabilitiesfeatures, the command is rejected. - Runtime preference is persisted in the
deploymenttable and optionally in Vault. - Org-level runtime policies can enforce Kata for all deployments.
# Deploy with Kata isolation
stacker deploy --runtime kata
# Deploy a single app with Kata
stacker agent deploy-app --app myservice --runtime kata
# Default (runc) — no flag needed
stacker deployThe --runtime flag is passed through the agent command payload. If the target
server doesn't support Kata, the command is rejected before reaching the agent.
| Requirement | Minimum |
|---|---|
| CPU | x86_64 with VT-x/VT-d or aarch64 with virtualisation extensions |
| Kernel | Linux 5.4+ with KVM module loaded |
| Docker | 20.10+ |
| Host OS | Ubuntu 22.04+ (playbook-tested) |
| Hardware | Bare-metal or another environment with documented /dev/kvm access |
Kata Containers require direct access to /dev/kvm. On Hetzner, that means
Robot bare metal, not Hetzner Cloud:
| Platform | CPU model | KVM Support | Kata Compatible |
|---|---|---|---|
| Hetzner Cloud CCX | Dedicated vCPU VM | ❌ | ❌ No /dev/kvm access |
| Hetzner Cloud CX / CPX / CAX | Shared vCPU VM | ❌ | ❌ No /dev/kvm access |
| Hetzner Robot | Bare-metal server | ✅ | ✅ Recommended |
Important: Hetzner Cloud VM types — including CCX — do not expose
/dev/kvmand cannot run Kata Containers. Use Hetzner Robot bare metal if you need Kata on Hetzner.
For bare-metal providers (Hetzner Robot, OVH, Scaleway), you control the host directly and can validate KVM before installing Kata.
The recommended way to provision Kata-ready servers is via the TFA project:
Do not use the Hetzner Cloud Terraform path for Kata. The hcloud
provider creates Hetzner Cloud VMs, and those VMs do not expose /dev/kvm.
For Hetzner, the valid flow is:
- Order a Hetzner Robot bare-metal server
- Install Ubuntu 22.04
- Run the
kata_containersAnsible role ordocs/kata/ansible/kata-setup.yml - Verify with
kata-runtime check
# Run the kata_containers role on an existing server
ansible-playbook -i <server-ip>, setup_stack.yml \
--tags kata_containers \
--private-key ~/.ssh/id_rsa \
--user rootThe kata_containers role:
- Validates KVM access (
/dev/kvm) - Installs Kata Containers from official APT repo
- Merges
kataruntime into Docker'sdaemon.json - Restarts Docker and runs a smoke test
Reference playbook and Terraform files are also available in this directory:
| Path | Description |
|---|---|
| ansible/kata-setup.yml | Standalone Ansible playbook |
| terraform/ | Historical Hetzner Cloud Terraform example — not valid for Hetzner + Kata because Cloud VMs lack /dev/kvm |
┌─────────────────────────────┐
│ stacker deploy --runtime kata │
└──────────────┬──────────────┘
│
▼
┌──────────────────────────────┐
│ Stacker Server │
│ 1. Validate runtime value │
│ 2. Check agent capabilities │
│ 3. Check org policy (Vault) │
│ 4. Enqueue command │
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Status Panel Agent │
│ 1. Detect /dev/kvm │
│ 2. Inject runtime: kata │
│ 3. Validate compose YAML │
│ 4. docker compose up │
└──────────────────────────────┘
| Document | Description |
|---|---|
| HETZNER_KVM_GUIDE.md | Detailed guide for Kata on Hetzner Robot bare-metal servers |
| NETWORK_CONSTRAINTS.md | Why network_mode: host doesn't work with Kata, and alternatives |
| MONITORING.md | Prometheus metrics, PromQL queries, and dashboard specs for Kata tracking |
Kata provides defense-in-depth for multi-tenant and untrusted workloads:
- Kernel isolation: Each container has its own guest kernel — host kernel exploits are contained.
- Hardware boundary: The VMM (QEMU/Cloud Hypervisor) enforces memory isolation via VT-x/EPT.
- Syscall filtering: The guest kernel's syscall surface is independent of the host.
- Compatible with OCI: Standard Docker images work without modification.