Skip to main content
k7d: fork isolated Kubernetes clusters — two clocks, ~105 ms and ~1.1 s
k7d is a Rust VMM that forks running VMs — including a live multi-VM Kubernetes cluster — with memory, disk, processes, and network identity intact. Boot once, then explore dozens of byte-identical worlds for RL and agent evals. Two clocks, always together: ~105 ms to fork the minimal CI guest (a busybox initramfs running k3s, test-enforced 1 s budget) and ~1.1 s to fork a 3-node Ubuntu 24.04 cluster running k3s + Cilium + Tetragon (48 s source bring-up). Forks share memory until they diverge, so 50 CI-guest copies of a cluster fit on one 64 GB box. k7d also owns the guest clock. An episode that is mostly waiting — readiness probes, backoffs, reconcile ticks — does not have to wait in wall time: lockstep clock jumps compress an 8.7-minute guest-time episode 1.83× with zero fidelity delta, and continuous KVM time dilation runs guests at 8× wall. See Time warp. Every VM boots through one daemon and one containerd shim, but you choose the engine: k7d’s in-process rust-vmm VMM (runtimeClassName: k7, the ~5 ms MAP_PRIVATE fork) or a stock, sha-pinned Firecracker under the stock jailer (runtimeClassName: k7-fc) when the VMM must sit outside the daemon’s address space — same guest, agent, fork/tree/pool verbs and in-guest Docker service. See Backends. For sandboxes at scale with a CLI / API / Python SDK, see K7.

Installation

scripts/quickstart.sh — doctor-check the host, fetch the release, boot a 3-node tree, fork 4 branches. Five minutes.

CoW fork

How a 5 ms VM fork works: shared memory until write, dirty pages, reflink keyframes, byte-identical copies.

Cluster mode

Create or adopt an N-node k3s cluster and fork it without agent restarts.

Ubuntu nodes

Stock Ubuntu 24.04 guests: k3s, Cilium, Tetragon, Longhorn, ML operators on mock GPUs — all forked live.

Time warp

Lockstep clock jumps and ×N dilation: delete idle wall time without touching what the guest computes.

GRPO / tree search

Wire k7d into a trainer or an MCP agent: fork_batch, protect, prune, auto_evict under RAM budgets.

Daemon API

JSON-lines protocol on /run/k7d/k7d.sock — every VM, tree, and clock verb.

Benchmarks

Hardware, exact commands, and every enforced latency budget — both clocks.

Backends

Native rust-vmm or stock Firecracker under the jailer (k7-fc): selection rules, feature matrix, fork mechanics.

Security model

One daemon, many VMs; the tree jailer (nft, cgroup, seccomp), guest-controlled path rules, the Firecracker profile, Docker as a guest service.

Formal verification

Kani on unsafe paths; Aeneas→Lean on the tree budget model.

Watch it