Status: prototype design, decided in a grill session on 2026-09-12 and brought in line
with main after wave 3 (the same day): open points that were closed carry an
Implemented note, statements that no longer matched the code were corrected. This
document is the source of truth for architecture decisions; the roadmap and agent plan
live in plan.md, the user-facing description in the README.
vm-manager is a Go MCP + REST server, a sibling of agent-manager, model-manager and the planned cluster-manager. It provisions virtual machines on a KVM host that behave like cloud-provider VMs: an instance metadata service (IMDS), a vTPM with measured boot, an immutable and composable OS image, fast boot, and Kubernetes prerequisites. Agents on the Giant Swarm agent platform create VMs through vm-manager and hand them to the CAPI based cluster-manager to bootstrap workload clusters.
Everything is systemd-native: images are built with mkosi, installed with systemd-sysinstall onto volumes from the systemd storage provider, configured with systemd-firstboot and system credentials, fed metadata by systemd-imdsd, layered with systemd-sysext delivered by systemd-sysupdate, measured with systemd-measure (PCR 11) and systemd-pcrextend (PCR 13), and observed through the guest's systemd-report uploads.
| Topic | Decision | Why |
|---|---|---|
| VM backend | QEMU/KVM driven directly by vm-manager on a Linux host; runtime behind a Go interface | Full control over SMBIOS, vTPM, vsock, netdev; vmspawn/KubeVirt can be added later |
| Bootstrap contract | Cloud-like IMDS user-data through a Giant Swarm IMDS provider | Exactly how AWS/GCP feed CAPI's kubeadm bootstrap output |
| Base OS | Arch Linux via mkosi (ParticleOS style: UKI, verity, sysupdate) | Host parity (systemd 261), fastest build loop; swap by changing Distribution= |
| Provisioning | Installer boot runs systemd-sysinstall onto a storage-provider volume, then reboots into systemd-firstboot | Same flow later works for bare metal; credentials bound to the VM's own vTPM |
| Network | Rootless userspace SDN via gvisor-tap-vsock embedded in vm-manager | No root, runs on laptops and GitHub Actions; IMDS served inside the stack |
| Attestation | swtpm vTPM + measured boot; vm-manager verifies a TPM quote and gates user-data | The "shielded VM" story: only integrity-proven VMs get bootstrap secrets |
| Code integrity | IPE: the kernel executes and loads code only from dm-verity volumes whose signature it verified (the root, the sysexts); vm-manager writes the image's certificate into each VM's UEFI db before every QEMU start (platform keyring), and a guest's reboot is a new QEMU; PID 1 and the kernel's usermode helpers lose CAP_MAC_ADMIN after the signed policy is loaded |
Immutable for real: root on the node can write to /var and /etc but runs nothing the image did not ship, and cannot switch the policy off. No container runs until images arrive as signed dm-verity layers (images/README.md) |
| Guest image signatures | image pull always verifies the artifact before it writes anything. A released vm-manager accepts the release's cosign keyless signature alone. A local build is signed at push with a build key (image push --sign-key, an ECDSA P-256 key image keygen makes per machine) whose public key only a vm-manager built from source on that machine carries, compiled in with -ldflags -X (make); image trust prints what a binary trusts |
The artifact decides what every VM trusts and what attestation accepts, so no flag, value or environment variable may accept an unverified one, and no setting of a released chart may add a signer: trust follows the binary's provenance. A lab boots its own builds with a vm-manager from the same source. The release pipeline checks that its binary trusts no build key. Trusting a file or a value at runtime would be a way around the release signature on any installation |
| Pod privileges | Unprivileged pod: /dev/kvm and /dev/vhost-vsock from vm-manager's own kubelet device plugin (vm-manager device-plugin, a DaemonSet of the chart, resource giantswarm.io/kvm); root with CHOWN, DAC_OVERRIDE, FOWNER, KILL, SETUID, SETGID and SETPCAP only; seccomp Unconfined with vm-manager's own filter, always installed (the runtime's default set plus AF_VSOCK; no switch turns it off, and vm-manager refuses to start without it) |
The device cgroup admits a host device only through the kubelet, and the runtime's default seccomp profile refuses the vsock sockets the guests' READY=1 and ssh need, so the pod gains vsock over RuntimeDefault and nothing else. CDI (node configuration per installation) and a security-profiles-operator profile (another component) were the alternatives |
| Kubernetes | systemd-sysext layer pulled at boot as a systemd-sysupdate component | One base image, N Kubernetes versions, measured into PCR 13 |
| User-data executor | Ignition in the mkosi initrd; cluster-manager sets KubeadmConfig format: ignition |
The standard first-boot provisioner for immutable images (Flatcar, FCOS); the guest agent only attests |
| CI | GitHub Actions with KVM for image build + boot e2e; unit/lint everywhere | Hosted runners expose /dev/kvm; no self-hosted infra to start |
| Repo | github.com/giantswarm/vm-manager, public, team-bumblebee | Consistent with siblings |
MCP /mcp + REST /api/v1 + /metrics + /healthz
|
internal/api, internal/server
|
internal/vm (service, state machine, JSON state dir)
+----------------+---------------+----------------+----------------+
| | | | |
runtime/qemu network imds storage attest
(QEMU, swtpm, (gvisor-tap- (GiantSwarm (io.systemd. (quote verify,
OVMF, QMP, vsock L2, provider, StorageProvider expected PCRs,
vsock READY) DHCP, NAT, attest, report, Varlink client) user-data gate)
169.254.169.254) sysupdate dir)
Packages (sibling layering, see development.md "Layout"):
internal/vm: VM lifecycle state machinecreating -> installing -> booting -> attesting -> readywithrunning(noREADY=1within the boot timeout),stopping,stopped,failedanddeleting, persisted as one JSON file per VM under the state dir ($XDG_STATE_HOME/vm-manager,~/.local/state/vm-manageror/var/lib/vm-manager). Each VM's QEMU and swtpm run as transient systemd services (internal/runtime/proc) so vm-manager restarts do not kill VMs:vm.jsonrecords their unit names and PIDs,Loadreattaches, and QEMU reconnects its netdev withreconnect-ms.internal/runtime/qemu: builds the QEMU command for phase A (installer) and phase B (installed), seeds the per-VM OVMF vars copy, talks QMP (status, powerdown, events), captures the serial console to a file, listens on AF_VSOCK forREADY=1from the guest (vmm.notify_socketcredential).internal/tpmruns the per-VM swtpm process,internal/runtime/procsupervises both. Every QEMU runs under its own seccomp filter (-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny) plus vm-manager'sio_uring_setupdenial, and when vm-manager runs as root (the chart's pod) QEMU and swtpm of each VM run as a user of their own (--vm-uid-base, one uid per VM, one group per network), started that way rather than dropping privileges themselves (-run-with user=would be killed byelevateprivileges=deny), with no capability in any set andno_new_privs. The VM's user owns only what its processes write (disk, variable store, console,tpm/,run/); vm-manager's own files of the VM stay root's; the network's group may only search the network's directory, and each VM's port there opens to that VM's own uid alone (internal/vm/isolation.go).internal/network: one gvisor-tap-vsockVirtualNetworkper network (subnet, gateway, DHCP static leases keyed by the VM MAC, DNS, NAT to host,GatewayVirtualIPsincluding 169.254.169.254). Each VM's QEMU attaches to its own port, a unix socket per VM, with-netdev stream,addr.type=unix; port security drops every frame whose source MAC, IPv4 source or ARP sender is not the VM's lease.ListenIMDSserves IMDS inside the stack and names the VM behind each connection, port-forwards expose 6443. ssh to a guest never crosses the network:exec_vmdials the guest's sshd on its vsock CID, the only place it listens.internal/imds: HTTP handler for the Giant Swarm provider, VM identified by the port its connection came through on the network whose listener accepted it (one handler per network).internal/storage+internal/varlink: minimal JSON-over-AF_UNIX Varlink client;io.systemd.StorageProvider.Acquireon thefsprovider creates per-VM target volumes (create=new,size=), attached as virtio-blk withserial=target; plain files below<state-dir>/volumeswhen no provider socket answers (storage.Detect).internal/attest+internal/tpmquote: quote parsing and verification, expected PCR policy per image (policy.json), AK pinning per VM; the Recorder of the reference boot that records golden values (vm-manager image golden).internal/images: catalog of base DDIs, UKIs, PCR policies and Kubernetes sysext versions.internal/metrics: host stats per VM plus the last guestsystemd-reportupload, exposed as Prometheus families and throughget_vm_metrics.cmd/vm-agent: static guest binary, see below.
mkosi project with two images (images/mkosi.images/base is the OS tree, the main image
in images/mkosi.conf is the disk built from it, images/mkosi.images/kubernetes the
sysext; images/README.md is the reference):
base: Arch, systemd 261,Bootable=yesUKI signed for PCR 11 (ukifywith the build's PCR key), erofs root withVerity=data/hash/signature, ESP. Ships:/usr/lib/udev/hwdb.d/45-imds-giantswarm.hwdbmatchingdmi:*:svnGiantSwarm:*withIMDS_DATA_URL=http://169.254.169.254/giantswarm/v1and the key table below; kernel cmdline carriessystemd.imds.import=yesso credentials are imported outside the initrd too./usr/lib/repart.sysinstall.d/: esp, root A/root-verity A/root-verity-sig A withCopyBlocks=auto, empty B slots (Label=_empty) for A/B updates, var./usr/lib/repart.d/: on the first installed boot creates the B slots sysinstall deferred and grows var.vm-sysinstall.service:ConditionCredential=vm.install-target, runssystemd-sysinstall $TARGET --erase=yes --confirm=no --welcome=no --chrome=no --variables=yes --reboot=no --kernel=<UKI on the installer ESP> --copy-locale=no --copy-keymap=no --copy-timezone=no, forwarding no credential (vm-manager passes them over SMBIOS on every boot, and a sealed credential on the ESP would be loaded into every boot's initrd), then reboots withsystemctl rebootitself (sysinstall's own reboot needs logind, which the read-only installer root cannot start). The stock interactivesystemd-sysinstall.serviceis masked.- sshd with
systemd-ssh-generator(AF_VSOCK port 22) and networkd DHCP. /usr/lib/sysupdate.kubernetes.d/*.transfer: url-file sourcehttp://169.254.169.254/giantswarm/v1/sysupdate/kubernetesinto/var/lib/extensions/kubernetes_@v.raw;/usr/lib/sysupdate.d/for OS A/B updates from.../sysupdate/base;/etc/systemd/import-pubring.pgpholds the build key.vm-agent(attestation only) withvm-agent-attest.servicein the initrd and the real system, andvm-report-upload.timer(every 15 s) postingsystemd-report uploadto.../report.persistent-etc.servicein the initrd: var partition,/etcoverlay with its upper directory on var,/rootand/optbind mounts, beforeinitrd-root-fs.target; an exitrd so thatsystemd-shutdowncan release the overlays and unmount var cleanly.- IPE:
lsm=…,ipeandsystemd.verity_root_options=root-hash-signature=autoon the UKI command line, the signed policy in the initrd (run only from kernel-verified dm-verity; kernel modules, firmware and kexec only from the base root, by its root hash), handed to the real root through/run/ipe, a manager drop-in that dropsCAP_MAC_ADMINonce PID 1 loaded it, andpersistent-etckeeping both out of the/etcoverlay's reach. - The initrd (mkosi sub-image) contains systemd-networkd, systemd-imdsd,
vm-agentand Ignition with itsignition-*units ported from upstream'sdracut/30ignition(ignition-fetch,-disks,-mount,-filesrequired byignition-complete.target, whichinitrd.targetrequires; the services carryConditionKernelCommandLine=ignition.firstboot; no fetch-offline, kargs or generator). The UKI cmdline carriesignition.platform.id=metal ignition.config.url=http://169.254.169.254/giantswarm/v1/user-data; vm-manager addsignition.firstbootthrough theio.systemd.stub.kernel-cmdline-extraSMBIOS string only on the first installed boot. Ignition comes from a pinned upstream tag (images/MakefileIGNITION_VERSION,scripts/build-ignition); Arch has no official package. The initrd-stage attestation unit must be orderedBefore=ignition-fetch.service.
kubernetes: sysext DDI with kubeadm, kubelet, kubectl, containerd, runc, crictl, cni-plugins and their units (started throughUpholds=onmulti-user.target, since presets cannot enable units of a layer merged during boot);extension-release.kubernetes_<kv>matching the base.
Build outputs per version (images/build/): giantswarm-vm-base_<v>.raw,
giantswarm-vm-base_<v>.efi, sysupdate/base/ (split root, verity and signature
partitions plus the UKI, SHA256SUMS, SHA256SUMS.gpg), kubernetes_<kv>.raw and
sysupdate/kubernetes/ (kubernetes_<kv>.raw, SHA256SUMS, SHA256SUMS.gpg),
policy.json (expected PCR 11 per phase path, PCR 13 per Kubernetes version, golden
firmware PCRs once recorded). Signing keys (verity certificate, PCR key for the UKI, PGP
for SHA256SUMS) are generated per build and kept in the git-ignored images/keys/;
vm-manager only serves signed artifacts and never holds private keys.
Phase A, installer boot (no persistent disk yet):
create_vmacquires a target volume, creates the swtpm state dir and OVMF vars copy, keeps a copy of the image's certificate, which every QEMU start writes into db (internal/uefivars), allocates a MAC + DHCP lease, stores user-data.- QEMU starts with
-kernel base_<v>.efi(direct UKI boot under OVMF), the base DDI attached read-only (serial=installer), the blank target (serial=target), swtpm viatpm-crb,-smbios type=1,manufacturer=GiantSwarm,product=vm-manager,serial=<vm-id>, and SMBIOS type 11 credentials:vm.install-target=/dev/disk/by-id/virtio-target,firstboot.hostname,ssh.authorized_keys.root,system.machine_id,vmm.notify_socket=vsock-stream:2:<port>. vm-sysinstall.serviceinstalls the booted OS onto the target: repart copies the root/verity/sig partitions bit-identically, creates the ESP and var (the B slots are deferred to the first installed boot), kernel-install installs the signed UKI with a Type #1 entry and no credential file,bootctl installadds the signed systemd-boot, then the unit reboots. QEMU runs with-no-reboot; vm-manager sees the exit and starts phase B. Measured: 12 s.
Phase B, installed boot (every boot from now on):
- OVMF -> systemd-boot -> UKI (measured into PCR 11 with
.pcrsig), credentials from the ESP. In the initrd: verity root (its signature verified by the kernel against the certificate the firmware's db put on the platform keyring), repart creates the B slots and grows var, systemd-imdsd early network brings up DHCP from the virtual network, imds import (hostname, ssh key ->/run/credstore),persistent-etc.servicemounts var, the/etcoverlay,/rootand/optunder/sysroot. - Still in the initrd (implemented:
images/mkosi.initrd.conf),vm-agent-attest.service(wanted byinitrd.target,After=systemd-pcrphase-initrd.serviceso PCR 11 carries exactlyenter-initrd, after the IMDS early network,Before=ignition-fetch.servicethrough a drop-in on the fetch unit) runsvm-agent attest --stage=initrd --timeout=90s: a challenge for the VM's AK, its nonce recovered with the vTPM's EK (TPM2_ActivateCredential), a quote of PCRs 0-7, 11, 12 and 13 over it with the AK, posted with both event logs. vm-manager verifies and marks the VM attested; until then/user-datais 503 withRetry-After, which Ignition's fetch stage retries with backoff (see the IMDS contract). A rejected quote fails the unit visibly (exit 2), and vm-manager kills the boot: the VM isfailedwith the verdict, user-data never released. The unit is skipped on the installer boot and outside vm-manager (ConditionFirmware=smbios-field(sys_vendor = GiantSwarm)), never by a kernel command line switch; a boot of vm-manager's that skips it reachesREADY=1without a verified ready quote and is killed as well. Proven bye2e/attestation_test.go: verified quote, user-data applied by Ignition; a boot on a distribution's OVMF build rejected with a golden mismatch on PCR 0 and killed; and bye2e/attestation_skipped_test.gofor the routes that skip the unit. - Ignition (first boot only:
ignition.firstbooton the cmdline) fetches the Ignition config from/user-data(ignition-fetch.service), runs its disks, mount and files stages, which write CAPI's files and systemd units (kubeadm config, the kubeadm unit) into/sysroot, then the initrd switches root. A VM without user-data gets 204 and the stages run with an empty config. - Real system: PID 1 first loads and activates the signed IPE policy the initrd left in
/run/ipeand then dropsCAP_MAC_ADMINfrom every process's bounding set (the usermode helpers lost it on the kernel command line); from here on only code from kernel-verified dm-verity volumes runs (images/README.md, IPE). A reboot of the guest ends QEMU (-no-reboot), and vm-manager starts the next boot as a new process. Then systemd-firstboot (machine-id, hostname, locale/timezone), networkd, thenvm-kubernetes.service(base image,After=network-online.target systemd-imds-import.service systemd-sysext.service systemd-tpm2-setup.service, wanted bymulti-user.target) reads/kubernetes-versionand/cni-versionfrom the IMDS and runssystemd-sysupdate --component=kubernetes update <version>, then--component=cnifor the CNI sysext (one per CNI release,<cni>-<release>, the only place CNI plugins come from: containerd'sbin_dirsis/usr/lib/cnialone) (explicit version selection; the artifact directory is served unfiltered because itsSHA256SUMSis signed at build time), removes any otherkubernetes_*.rawandcni_*.raw, merges the extensions withsystemd-sysext refresh(daemon-reload viaEXTENSION_RELOAD_MANAGER=1,Upholds=starts containerd and kubelet) and extends PCR 13 withsystemd-pcrextendusing each file'sSHA256SUMSline (<sha256> kubernetes_<version>.raw, then the cni one), so the host computes PCR 13 from the artifacts (policy.jsonsysexts.<component>.<version>, images/README.md). A VM without a Kubernetes version skips the unit. CAPI's unit, orderedAfter=vm-kubernetes.service, runskubeadm init|joinand writes/run/cluster-api/bootstrap-success.complete.vm-agent-attest.serviceof the root (implemented:images/mkosi.images/base,After=vm-kubernetes.service systemd-pcrphase.service,Before=multi-user.target) runsvm-agent attest --stage=readyand posts a second quote covering PCRs 13 and 15 and the full phase path forget_vm_attestation.READY=1(step 8) waits forvm-kubernetes.serviceand that quote; the e2e measures 14 s from the installed boot to ready with a 2 s download. - PID 1 sends
READY=1over vsock;systemd-report uploadpushes metrics on a timer. Measured: 11 to 15 s from the installed boot toREADY=1for the bare image, 11 s for a reboot to ready.
Fast path for later: pre-install on the host with systemd-repart from the same
repart.sysinstall.d definitions against the base DDI (needs root or io.systemd.Repart),
skipping phase A when TPM-bound install credentials are not needed.
Each point starts with Implemented or Resolved and names the PR or test that closed it; open follow-ups are scheduled in plan.md.
- PCR 13 and sysexts. Implemented (#27,
e2e/kubernetes_sysext_test.go). systemd 261 measures only stub-loaded extensions (<uki>.efi.extra.d/*.sysext.rawon the ESP) into PCR 13, and those extend the initrd (/.extra/sysext/is searched only there), not the installed root; the measured object is the stub's cpio archive, which a host cannot predict from the artifact alone, and the 206 MB would have to fit the 512 MB ESP before the first installed boot. Decided:vm-kubernetes.serviceextends PCR 13 itself after the merge withsystemd-pcrextendand the file'sSHA256SUMSline. PCR 13 of a boot is then exactly three events, "os-separator" (initrd,systemd-pcrosseparator.service), the Kubernetes line and the CNI line, eachPCR := sha256(PCR || sha256(word));images/scripts/verify-sysextwrites the published sha256 of every sysext assysexts.<component>.<version>intopolicy.json, and the ready-stage verifier computes the VM's Kubernetes x CNI pair from them withattest.SysextPCR(one entry per sysext, never per pair), and a VM without Kubernetes has the os-separator value alone; PCR 13 is never golden, and a VM whose versions have no entries is rejected. Verified end to end bye2e/kubernetes_sysext_test.goagainst the vTPM. - Volatile
/etc. Implemented (#25, #30,e2e/persistent_etc_test.go): the image no longer boots withsystemd.volatile=overlay.persistent-etc.servicein the initrd mounts the var partition on/sysroot/varand an overlay on/sysroot/etcwhose upper and work directories are/var/lib/etc-overlay/, plus/rootand/optas bind mounts from var, beforeinitrd-root-fs.target; the root stays the read-only verity erofs. Firstboot's output, the machine ID, SSH host keys, enabled units and whatever Ignition writes to/etcsurvive reboots, and var is unmounted cleanly at shutdown: systemd-shutdown's exitrd (tmpfiles.d/vm-manager-exitrd.conf,run-initramfs-{root,usr}.mount) releases the/etcoverlay and the Kubernetes sysext's/usroverlay, both pinned by PID 1's own mappings, which keep var's superblock alive, and itssystem-shutdown/vm-manager-varhook waits for the kernel's asynchronous tear-down of the sysext's loop device, which is what finally puts the superblock (e2e/persistent_etc_test.go; details inimages/README.md, "Persistent state"). - Ignition and
/var. Implemented by the same change (#25,e2e/ignition_test.go): the var partition is mounted on/sysroot/varbeforeinitrd-root-fs.target, andignition-files.serviceruns after it (After=initrd-root-fs.target sysroot-var.mount), so what user-data writes below/var,/etc,/rootor/optlands on the partition. A VM whose initrd quote is rejected is killed before its user-data is released (the tamper subtest ofe2e/attestation_test.go). - No host loopback alias. No guest address is translated to the host's
127.0.0.1, where vm-manager's own API listens; the last host address of a network (.254in a /24) stays reserved, never leased and not answered, so addressing is the same as when it was an opt-in alias. - Sysext file lifecycle. Implemented (#27). systemd-sysext merges every
kubernetes_*.rawit finds and sysupdate.d(5) rejectsInstancesMax=below 2, sovm-kubernetes.servicedeletes everykubernetes_*.rawother than the requested version before it refreshes; exactly one file, one merged extension, one PCR 13 measurement per boot. A changed/kubernetes-versiontakes effect on the next boot (no live switch of a running node). - PCR 1 and 5 are per VM. Implemented by event-log replay (#316,
internal/attest/bootconfig.go,e2e/boot_config_attestation_test.go). They differ between two VMs on the same firmware and image, soattest.GoldenIndexesis 0, 2-4, 6 and 7: EDK2 measures the ACPI tables (sized for the VM) and the SMBIOS tables into PCR 1 (SmbiosMeasurementDxe, type 11 OEM strings are not filtered, and vm-manager's are per-VM credentials: hostname, machine ID, SSH key, notify socket), as is theBoot####entry whose device path carries the ESP's partition GUID; PCR 5 holds the GPT of the installed disk with per-install partition UUIDs. The verifier replays the PCR 1 and 5 events of the firmware event log (and the initrd's os-separator from the userspace log) to the quoted values, every event one a boot vm-manager starts has and bound to its data where the log carries it. What the guest can change is judged: the GPT must hold the partitions of the image's installed disk and nothing else (installedDisk, kept equal torepart.sysinstall.dby a test: types, labels with the image's id and version or_empty, attributes, counts), so a partition added, retyped, relabelled or given another attribute fails the next boot;BootOrder, theBoot####options and systemd-boot'sloader.confmust be what the VM's first verified boot measured (the record'sbootConfig; before that boot only vm-manager's installer wrote them). The ACPI and SMBIOS tables and the SMBIOS structures systemd-boot and systemd-stub measure come from QEMU and vm-manager's arguments; the guest cannot write them, they are replayed, not compared, so a host's QEMU update does not fail its VMs. - The ESP and the kernel command line. Implemented (#293,
e2e/kernel_cmdline_attestation_test.go). The installed ESP is writable for root on a node. With Secure Boot off, systemd-stub used a command line a Type #1 entry'soptionspassed instead of the UKI's own, and credentials or extension images on the ESP reach the initrd; PCR 11 sees none of it. Now the image signs its UKI and systemd-boot with its key and says so inpolicy.json(secure_boot); vm-manager enrolls the image certificate as PK, KEK and db before every start (uefivars.EnrollSecureBoot) and boots every VM on its own OVMF build with SMM and Secure Boot (firmware/README.md), so the stub ignores loader command lines;create_vmrefuses an image withoutsecure_boot. The installer puts no credential on the ESP (vm-manager passes them over SMBIOS on every boot) and the image turns off the pcrlock notification that would write one. Both stages quote PCR 12; the verifier replays the firmware event log and the userspace log'sos-separatoragainst it, binds every command line to its text and requires exactly what vm-manager passed (attest.Policy.KernelCmdlineExtra, the VM record'skernelCmdlineExtra, set when its installed boot starts), and rejects any credential or configuration extension archive: systemd-boot still measures an entry'soptions, so such a change also fails attestation. The initrd quote covers PCR 13 too and accepts only zero or the os-separator, so an extension image from the ESP fails the quote that releases user-data. - VM processes and vm-manager restarts. Resolved: QEMU and swtpm run as transient
systemd services (
systemd-run --service-type=exec -p RemainAfterExit=yes, unitsvm-manager-<id>-qemuand-swtpminvm-manager.slice), started under the user manager when vm-manager is unprivileged and the system manager when it is root (internal/runtime/proc.SystemdExec). systemd is their parent, so a vm-manager exit leaves them running;--detach-vms-on-exit(default) makesClosehand them over andLoadreattaches through the handles invm.json(processes): volume, lease, swtpm, QEMU with QMP, notify subscription, supervisor. The exit status survives too:RemainAfterExitkeepsExecMainCode/ExecMainStatusuntil the watcher (a pidfd on the main process) has read them and releases the unit.--scopewas rejected because a scope's process stays a child of vm-manager, its exit status is lost to a successor and its stderr pipe breaks with the parent; the service mode needs no cgroup delegation for vm-manager's own unit. Without a reachable service manager the launcher falls back to plain child processes and warns that VMs end with vm-manager.
Plain HTTP, GET http://169.254.169.254/giantswarm/v1<key>, text bodies, 404 with an
empty body for unknown and unset keys (systemd-imdsd aborts an error response that
carries body bytes before it reaches its own 404 handling; only a bodyless 404 becomes
KeyNotFound, which systemd-imds --import tolerates for an unset key). /user-data
is not an hwdb key: its client is Ignition's cmdline provider (ignition.config.url), not
systemd-imds --import, and its status codes follow what Ignition v2.27.0 does with them:
200 with the raw Ignition JSON once released; 503 with Retry-After while gated, because
internal/resource/http.go (shouldRetryHttp) retries every status >= 500 with a 200 ms
backoff doubling to 5 s until --fetch-timeout (2 min by default), whereas 403 and 404
end the fetch stage at once (internal/resource/url.go fetchFromHTTP maps 404 to
ErrNotFound, anything else to ErrFailed); 204 when the VM has no user-data, because an
empty body parses as ErrEmpty (config/util/config.go), which the engine takes as "no
config" and continues, while a 404 would drop the boot into emergency.target; 410 once
the boot it was released to is past Ignition (its verified ready-stage quote or its
READY=1, whichever comes first), when vm-manager drops it from memory and the state
directory for good. No later boot runs Ignition (ignition.firstboot is passed only
until then), so the 410 reaches only what has no business reading user-data, such as a
pod on the node. The Go key
table is the single source of truth and generates the hwdb record at image build time.
| Key | hwdb property | Content |
|---|---|---|
/hostname |
IMDS_KEY_HOSTNAME |
VM name |
/region, /zone |
IMDS_KEY_REGION/ZONE |
host name, network name |
/public-keys/0 |
IMDS_KEY_SSH_KEY |
first authorized key |
/user-data |
none (Ignition's ignition.config.url) |
CAPI bootstrap data as Ignition JSON; 503 + Retry-After while gated by attestation, 204 when the VM has none, 410 once the first boot consumed it |
/instance-id, /kubernetes-version, /cni-version, /metadata/<k> |
extra | plain values |
/layer-certificates |
extra | the installation's layer certificates of create_vm as concatenated PEM in the caller's order; 404 when none |
/attest/challenge, /attest/quote |
agent only | attestation protocol below |
/report |
agent only | systemd-report upload sink |
/sysupdate/<component>/ |
sysupdate | SHA256SUMS, SHA256SUMS.gpg, artifacts; served unfiltered, the guest picks the version from /kubernetes-version and /cni-version |
Attestation protocol: POST /attest/challenge with JSON {ak_pub} (the attestation key's
TPMT_PUBLIC) returns {credential_blob, encrypted_secret}: a fresh 32-byte nonce, valid 5
minutes and once, sealed for that key under the VM's endorsement key the way
TPM2_MakeCredential does. vm-manager reads the EK (the TCG default RSA 2048 template) from
the VM's vTPM itself, before the VM's first QEMU (internal/tpm EndorsementKey, over a data
channel of its own), and keeps it in the VM's record. The agent recovers the nonce with
TPM2_ActivateCredential, which only the vTPM holding that EK performs, and only for the key
the credential names while it is loaded there. POST /attest/quote with JSON {stage, nonce, ak_pub, quote, signature, pcrs:{sha256:{"0":..}}, event_log, userspace_log} (binary fields
base64, stage is initrd or ready). Verification: the nonce was sealed for ak_pub, so
the key is certified against the VM's EK, the first quote of the VM's first boot included;
signature over the quote with ak_pub, nonce match,
PCR digest matches pcrs, PCR 11 equals the value computed with systemd-measure calculate
for the image's UKI and the stage's phase path (enter-initrd for initrd,
enter-initrd:leave-initrd:sysinit:ready for ready), PCRs 0, 2-4, 6 and 7 equal the
image policy's golden values recorded by vm-manager image golden (PCR 1 and 5 differ per
VM: the firmware event log is replayed against them, see the point above), and at ready
PCR 13 equals the
value computed from the policy's sysexts entries of the VM's Kubernetes and CNI
versions (written by images/scripts/verify-sysext; the os-separator alone when the VM has
none). The image's
policy.json declares "pcr15": "layer-certificates" when its initrd measures layer
certificates (images/scripts/verify writes it): the ready quote of such an image must
cover PCR 15 whether or not the VM is served certificates, since the guest picks the PCRs
it quotes and "none served" is proven as "none measured". An image whose policy lacks it
predates layer certificates: it may leave PCR 15 out (the verdict says so) and is rejected
when the VM is served certificates, which it cannot enroll. A quoted PCR 15 is always
verified: the verifier replays the PCR 15 records of userspace_log (systemd's
/run/log/systemd/tpm2-measure.log) to the quoted PCR 15. Every PCR 15 record is bound to
its content before it is replayed: a systemd string record whose sha256 digest is the
sha256 of its word, the word a machine-id:, file-system: or layer-certificate:
measurement; any other record (another content type, a digest that is not its word's, an
unknown word such as systemd-cryptsetup's HMAC of a volume key) rejects the quote. The
layer-certificate:<sha256 of the DER> words must name exactly the certificates
/layer-certificates serves, in order (none served, none measured); the initrd extends
PCR 15 with one such word per certificate before it seals the .dm-verity keyring, and
get_vm_attestation shows the digests the node measured (ready.layerCertificates). Only the
initrd stage unlocks /user-data; the ready stage makes the boot ready. The
certified AK of the first verified initrd quote is pinned and kept in the VM's record across
restarts of vm-manager.
Every quote is verified; nothing in serve turns that off or accepts a PCR without a
golden value. A rejected quote at either stage, READY=1 without a verified ready-stage
quote of the same boot, and a boot without one by --boot-timeout all end the boot: QEMU
is killed and the VM is failed with the reason. Golden values are recorded once per
image and firmware build, by the build and release pipeline: vm-manager image golden <image> boots a reference VM in its own process (attest.Recorder: every check but the
golden comparison, no user-data), writes the PCRs of its ready quote as golden.sha256
and the firmware build as golden_firmware into the image's policy.json (which
images/scripts/verify preserves across rebuilds of the same version), and boots a
fresh VM that must verify against them. The release pipeline runs it for every release
on the release's container image, its vm-manager, QEMU, swtpm and firmware
(hack/guest-image-golden.sh), so a released guest image artifact carries them; a local
build records its values the same way. A golden mismatch of a firmware PCR names the
build the values were recorded for next to the one the server boots.
CAPI's kubeadm bootstrap provider writes cloud-config (or Ignition) into a Secret and expects an infrastructure provider to hand it to a VM that runs it and registers as a node. With vm-manager:
- cluster-manager (or an agent) creates a network for the cluster (
create_network), sets KubeadmConfigformat: ignitionand callscreate_vmwithuser_dataset to the bootstrap Secret's Ignition JSON, pluskubernetes_version, that network and sizing.create_vmrefusesuser_dataon the network the server creates at startup (--default-network): every caller's VMs share that one L2 segment, so a node bootstrapped there would sit next to other clusters, reachable on its address and its ARP. A network per caller instead would need a caller identity the API does not keep (every authenticated caller may use every network), and a CAPI provider has the cluster to create the network for anyway. The default network stays for VMs without user-data. The kubeadm unit must be orderedAfter=vm-kubernetes.service(one line throughadditionalConfig): that unit pulls the sysext with kubeadm, containerd and kubelet, applies its modules and sysctls and waits for containerd, so kubeadm's preflight passes on the first boot. - The VM installs (phase A), boots (phase B), attests from the initrd, and only then does Ignition receive the user-data and write CAPI's files and units; kubeadm runs from those.
- The node's
providerIDisgiantswarm-vm://<name>, set via kubelet extra args in the KubeadmConfig: user-data is fixed whencreate_vmis called and the id is only known afterwards, so the caller keys it by the VM name it chooses (the Machine name);get_vmreports IP, attestation, and readiness so the caller can set the infra Machine ready when the node registers. - Control plane endpoint: v1 uses the first control plane VM's IP (kubeadm's default
advertise address; no
controlPlaneEndpoint) and a host port-forward for 6443, withapiServer.certSANs: [127.0.0.1, localhost]so the admin kubeconfig works throughforward_port; multi control plane later uses kube-vip on a reserved IP of the network, which port security drops until the network admits that address on the control plane VMs' ports. READY=1is sent when the boot transaction is complete, and the kubeadm unit is part of it: a VM with user-data reachesreadyonly afterkubeadm init|joinsucceeded, which makesget_vmstatereadythe bootstrap signal. The server's--boot-timeout(default 4 min) must cover kubeadm init with its image pulls, or the VM is reportedrunningwith alastErroralthough nothing failed; the caller should either raise it or usewait_for: installedand poll.- Remediation is delete + recreate. A thin CAPI infrastructure provider (or cluster-manager glue) that wraps this API is a follow-up.
Proven by e2e/kubernetes_cluster_test.go (make e2e), which runs exactly this through
the MCP API. The user-data is Ignition 3.4.0 with two files and one enabled unit, the
shape of CAPI's bootstrap/kubeadm/internal/ignition/clc/templates: /etc/kubeadm.yml
(0640, the kubeadm config), /etc/kubeadm.sh (0700: kubeadm init|join --config /etc/kubeadm.yml, then /run/cluster-api/bootstrap-success.complete, then the config is
moved to /tmp) and kubeadm.service (Type=oneshot, ExecStart=/bin/bash /etc/kubeadm.sh as CAPI 1.14 writes it, ConditionPathExists=/etc/kubeadm.yml, After=network-online.target vm-kubernetes.service,
WantedBy=multi-user.target). The kubeadm config is kubeadm.k8s.io/v1beta4: for the
control plane InitConfiguration (nodeRegistration.criSocket: unix:///run/containerd/containerd.sock, kubeletExtraArgs: [{name: provider-id, value: giantswarm-vm://cp-1}]), ClusterConfiguration (kubernetesVersion, imageRepository: gsoci.azurecr.io/giantswarm, networking.podSubnet: 10.244.0.0/16, the SANs above) and KubeletConfiguration (cgroupDriver: systemd); for
the worker JoinConfiguration with discovery.file (a kubeconfig of <cp ip>:6443, the
cluster CA and the token from kubeadm token create --print-join-command on the control
plane, since the API server answers no cluster-info request without credentials;
docs/reference-cluster.md "Joining nodes") and the same nodeRegistration. Measured on
the hosted e2e runner, on the IPE image with Cilium and every image signed: the control plane
is Ready with every pod running 93 to 125 s after its create_vm (kubeadm init 17 to 24 s,
installed boot to READY=1 34 to 48 s); the worker is Ready 71 to 121 s after its
create_vm (kubeadm join about 2 s), most of it pulling Cilium; mirroring and signing the
nine images on the host takes 22 to 60 s.
What sysinstall/firstboot do not cover: writing CAPI's files and units (Ignition) and
proving integrity before secrets are released (vm-agent attest).
Read-only: get_info, get_host, list_images, get_image, list_networks, get_network,
list_vms, get_vm, get_vm_console, get_vm_metrics, get_vm_attestation.
Writes: create_network, delete_network, create_vm (name, image, kubernetes_version, cni_version,
cpus, memory_mib, disk_gib, network, user_data, hostname, metadata,
layer_certificates, wait_for none|installed|attested|ready), start_vm, stop_vm,
reboot_vm, delete_vm, exec_vm, forward_port. REST mirrors each under /api/v1.
| Tier | Target | Budget | Runs | Runs on |
|---|---|---|---|---|
| T0 unit | every package with fakes (fake runtime, fake storage, httptest IMDS, CAPI Ignition fixtures, go-tpm simulator) | < 30 s | every PR | test.yml, ubuntu-latest; make test vet-e2e also compiles the e2e tag, make lint lint-e2e lints it |
| T1 contract | in-process MCP client over httptest against the fake runtime; REST parity via statusFor |
< 10 s | every PR | test.yml, ubuntu-latest |
| T2 image | mkosi build + image-verify: systemd-dissect, ukify inspect, systemd-measure calculate |
minutes | every PR touching images/, vm-agent or the workflow; push to main; nightly through e2e | image.yml, archlinux:latest container (--privileged) on ubuntu-26.04, no mkosi cache (the current Arch repositories, as the release's guest-image job); artifact guest-image |
| T3 boot e2e | Go tests tagged e2e with the real runtime on KVM (e2e/): install + reboot + READY, IMDS + firstboot, Ignition files + units applied, persistent /etc, sysext merged and measured, IPE enforced and locked, attestation record / golden / tamper and the routes that skip it, 1 CP + 1 worker from CAPI-shaped Ignition (skipped for an image with IPE) |
< 90 s per test except the cluster (2.5 to 3 min) and attestation (111 s for three servers); about 6 min for the suite, 45 m go test ceiling |
every PR and push to main: fast subset (install/boot, IMDS including networks with overlapping CIDRs, persistent /etc, sysext, IPE); nightly and manual: the full suite |
e2e.yml, hosted ubuntu-26.04 with nested KVM and vhost_vsock, qemu/swtpm/ovmf from apt, the guest-image artifact built in the run or reused from main; developers run make e2e on their KVM host |
Boot-time budgets were set at installer phase to reboot < 60 s and installed boot to READY
< 10 s; measured on the development host: install 12 s, installed boot to READY=1 11 to
15 s (the sysext pull and the ready-stage quote are inside that), reboot to ready 11 s.
The e2e tests print these as install_seconds=, boot_to_ready_seconds=,
reboot_to_ready_seconds= and enforce generous ceilings; the metrics export them per VM
(vm_manager_vm_install_seconds, vm_manager_vm_boot_to_ready_seconds).
For vm-manager serve: qemu-system-x86_64, vm-manager's own OVMF build (make firmware), swtpm, systemd
(systemd-ssh-proxy only for a person's own ssh root@vsock/<cid>), /dev/kvm and /dev/vhost-vsock accessible by the
service user, optionally systemd 261's io.systemd.StorageProvider (plain files
otherwise). For the image build: mkosi >= 27, erofs-utils, pefile, gnupg, util-linux
(sfdisk), Go 1.26+. For the cluster e2e additionally kubectl and internet access from
the VMs. install.md has the packages and the device permissions.