Skip to content

About

Node level of rustkube (Rust Kubernetes): kubelet, kube-proxy, cni

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,387 Commits

Folders and files

Repository files navigation

rustkube-node

The node level of rustkube — the Kubernetes worker components, in Rust. Split into its own repo for parallel development; the code stays upstream-shaped and monorepo-mergeable.

Current code: main at 06b91b5, audited 2026-10-09, workspace version 0.13.0 plus unreleased changes (shipped to stormcos as stage goldens of main; latest golden-rustkube-node-2eabd6fc174b, release request stormcos#424). The kubelet registers Nodes, maintains heartbeats, runs Pods, and reconciles stormvm VirtualMachineInstances through stormpump. This is a partial Kubernetes node implementation; remaining gaps and unsupported promises are tracked in the capability audit. The event-driven UID worker implementation is merged (#114), with partial-start unwind (#100), event-driven reconciliation (#101) and bounded runtime calls (#99). Live measurement on a node is #102 (C2NR0Q2, owner's choice on #110).

Event-driven reconciliation

The turbomode implementation uses rustkube's pinned reactor dependency. Pod and VMI assignment/volume watches enqueue coalesced reconciliation work; Pod and VM subscriptions run independently; runtime work uses one Pod/VMI executor (--pod-workers passes at once, default 16 per CPU within 32–256, #138) with name/claim reservations and recovery barriers (#100). Stormpump exits and Linux static-manifest changes also wake workers. CSI registrar sockets use filesystem notifications; successful registrations wake Pod workers, with deadlines for pending failures. Failed or incomplete Pod/manifest reads cannot stop live Pods by treating an unknown desired set as empty. Status publication retains startTime (except one from before this boot: a pod kept across a reboot starts now, #239), skips unchanged status and uses the observed resourceVersion. Pod teardown retains its runtime record until stopping and volume cleanup succeed. CSI teardown preserves its retry record through failed unstage calls and refuses cleanup from unreadable records or incomplete Pod lists. Pod and VMI adapters share that executor. Failed startup/cleanup records are retained, and same-name successors wait for the previous UID to release its resources.

The full workspace build and tests last passed on dev at c74b589 (270 kubelet unit, four integration, 25 CNI and 17 proxy tests). Cleanup retains refused engine releases, CSI publication and teardown serialize by driver/handle, and failed runtime recovery keeps admission closed. PV and VolumeAttachment changes route through an inverse claim index; failed collection reads retain the index. VM status and migration writes carry UID guards. A VM start records what it puts in stormpump (each tap deposit before it is sent, each volume and spec handle as it is registered) outside the start's future; a failed, panicked or abandoned start is unwound with stormpump's DEPOSIT_WITHDRAW (stormpump#63) and handle releases. Deposits are named tap-<nic> per engine client, so the window from the first deposit to the spawn's answer, and every withdraw, is serialized across VMs. The next start of that VMI waits while one of its taps is still held, and its deletion (and the name) is held until the tap is withdrawn. A failed CNI ADD is followed by DEL before the sandbox goes, and a claim reclaim runs to completion even if its HTTP client disconnects (#100). Subsecond startup has not been measured on a live node. No global sync tick remains (#101): a live Pod or VMI is looked at again only on an event or its own deadline (a probe period, a backoff, a pending retry, a guest-agent poll), and the service mirror, system claims, reclaim, CSI sweep and VM maintenance run on file, API-watch and stormblock volume-watch events. What still polls is counted in kubelet_timed_reconciles_total (see configuration). A stormpump exit wakes its own Pod or VMI worker only (#115): the exiting handle is mapped to its pod (container, then sandbox) or its VMI, and only a handle no record names (or a lagged channel) wakes every workload. The exits are recorded as they arrive, the VM manager is asked only about a handle no container has (bounded at 1 s), and an exit read before its start recorded the handle is kept for it (#285). A ring call or a stormblock call slower than 1 s is logged with its name and time. With --runtime cri the kubelet follows the runtime's GetContainerEvents stream (#116, upstream's evented PLEG): each event wakes the Pod its sandbox names (else the Pod holding that container), every Pod looks once when the stream opens, and only while no stream is open (a runtime without the RPC, CRI-O without enable_pod_events, or a dropped stream being reopened on a 1–30 s backoff) do Pods keep the counted sync_interval fallback. See the design and baseline and #102 for validation. Builds run on dev only after pushing. Main's tap address pump, snapshot reconciler, VM startup backoff and disk-owner sweep remain active. A failed VMI LIST retains the last desired set; stopping a VMI detaches its disks, while the owner sweep decides when to delete them.

Retries on remote calls

Every call to another process (the apiserver, the node's stormblock engine, the registry, stormdrive, CSI drivers, and the test container's apiserver calls) goes through one helper, pkg/retry (#211): a transient failure (timeout, connection refused or reset, 408/429/500/502/503/504) is retried with jittered exponential backoff under a per-dependency policy (attempts and a whole-operation deadline), a real answer (any other 4xx/5xx) comes back at once, a POST that may have been applied is not repeated unless it is a named create or a review, and every retried call logs its attempts ("succeeded on attempt 3 after 4.1 s" / "gave up after 4 attempts / 6.2 s: …"). Probes, CRI calls, PID 1's ring and CNI execs are not retried at the call, each for a stated reason. The policies and every call site are in docs/retries.md.

Pod start timing

Every pod start says where its time went (#132). The kubelet keeps one record per pod UID from the moment its pod list (a watch event, or a static manifest read) delivers the pod, across every retry, to the moment the apiserver acknowledges Running, and then writes it once, as the annotation storm.io/start-timing, a StartTiming Event, the histogram kubelet_pod_start_phase_duration_seconds{phase} and one INFO log line:

storm.io/start-timing: scheduled=850ms wait=1.2ms image=0.3ms volumes=4.4ms sandbox=40ms
  init=0.0ms containers=180ms report=8.1ms total=236ms attempts=1 workers=3/64 pending=1
  sandbox/acquire=6.2ms sandbox/cni=31ms sandbox/status=0.1ms sandbox/other=2.7ms volume/data=3.9ms volume/(serviceaccount)=0.4ms container/app=180ms
phase from → to
scheduled the bind → seen here. The bind is rustkube's storm.io/scheduled-at annotation (microseconds, written with spec.nodeName, rustkube#190), else the pod's PodScheduled transition, else its creationTimestamp; those two are whole seconds and carry up to a second of truncation (#135). Absent for a pod bound before this node booted (kept across a reboot and started again, #239). Wall clocks of two machines (exact when the scheduler is on this node): negative when they disagree by more than the gap
wait seen → the start attempt that succeeded began: admission, image and volume waits, earlier attempts
image the pod's images first asked for → the last resolved. A pallet is ~0; a pull is one registry lookup of the image's golden record (no clone: #104)
volumes the pod's volumes in that attempt: claims cloned and attached, configMaps, secrets, projected, the ServiceAccount token, resolv.conf and log dirs. Each spec volume also as volume/<name>
sandbox the sandbox made, its network (CNI) included, → its address read. Taken apart (#139) when the attempt made it: sandbox/acquire (stormpump SandboxAcquire, the warm namespace holder; 0 on the host network), sandbox/cni (the CNI ADD, the plugin's exec included), sandbox/status (the address read) and sandbox/other (the rest: the runtime's checks, retried DELs of earlier failed networks). A CRI runtime gives only status and other. No step is a stormblock call Under Cilium, a sandbox/cni of seconds right after a reboot, shrinking pod by pod, is the agent's endpoint-create rate limiter, not the kubelet or a claim (#310, stormcos-cilium#38).
claim/<volume>/… a claim's steps (#95), after its volume/<name>: lookup (the PVC, then its PV and the engine's volume list together, the room checked), room (inside lookup, a new volume only: the class's policy read while the capacity lock is waited for, then the engine's slabs and volumes together), how it was made with its time (blank: a clone of the class's sealed blank; clone: of a source; raw: a Block claim; absent when the volume already existed), attach (ublk) and bind (the PV written, the claim bound; only where the start waits for it, the VM path: a pod's start runs it in the background since #95, as the control plane has normally bound the claim already). The filesystem mount is PID 1's, when the container is created, so it is in containers
init init containers run to completion
containers every app container created and started; each also as container/<name>. Creating one includes making its own root (#104): the clone of the image's golden, its attach and PID 1's mount. Taken apart (#311) on stormpump, after each container/<name>: lookup (the engine's listing, to find the golden), clone, attach, mount (PID 1 mounting the root), define (image config, image volumes, SpecDefine), volumes (at the start: the log directory and the pod's mounts registered, a claim's filesystem mounted and its fsGroup applied), spawn (stormpump Spawn), identity (published for cadvisor, its pid asked of the engine), other (the rest: the kubelet's own)
report the Running status write sent → acknowledged
total seen → Running acknowledged

image overlaps wait (images resolve off the worker while the pod waits). A static pod is not annotated (its mirror is the API's object, #258), so it gets the log line and the histograms only, and no ServiceAccount token (#262: it is marked kubernetes.io/config.source: file, as upstream marks a manifest's pod; the control plane's static pods start before there is an apiserver to ask). The first static pod to run is said once, first static pod <ns>/<name> running N ms after the kubelet started, with the kubelet's own startup steps (exec: the process's start to main; then logging, flags, hello (the first log line), cni, engine, runtime, credentials, kubelet), which Kubelet starting for node … also carries. A step of 50 ms or more also says what the process did in it, flags=1577ms(cpu 12ms, 340 faults, 3 waits, 1 preempted): CPU time, major page faults, and the times it blocked and was preempted (getrusage), so a step that waited says on what. The annotation's merge patch changes the pod's resourceVersion; a status write racing it gets a 409 and is retried on the newer object.

workers=<busy>/<limit> is the executor's passes running when the start attempt began, this one included, out of --pod-workers, and pending=<n> the pods seen here and not yet started, this one included (#138). A large wait with workers at its limit is the pool; with workers below it, the wait was the pod's own (an image, a volume, the network). The annotation's patch is written off the worker, after Running is acknowledged.

attempts is 1 for a pod with nothing to wait for (#134). A start waits up to 100 ms for an image it has just asked for, which covers a golden or a present image; a pull that takes longer leaves the pod ContainerCreating ("waiting for image …") and its completion starts the next attempt. More than one attempt means the pod waited on something: an image pull, a volume, the network or storage, named in its waiting reason and Events. report is the one status PUT and nothing else, so a long report is the apiserver's write. The ordinary lifecycle Events (Pulling, Pulled, Created, Started, StartTiming) are queued and written in order by one background sender, so containers does not include their POSTs; Warnings are written before the start moves on.

VMI start timing

A VMI's start says where its time went too (#259), in the same annotation on the VMI, a StartTiming Event and one INFO line (VMI <ns>/<name> started: …), written after Running is answered:

storm.io/start-timing: created=480ms wait=0.4ms unwind=0.1ms lock=0.0ms seed=0.0ms keys=0.0ms
  owner=3.1ms disks=61ms network=0.0ms resume=0.0ms window=0.0ms launch=38ms record=4.2ms
  report=9.8ms total=117ms attempts=1 disk/root=61ms
step from → to
created the VMI's creationTimestamp → first seen here (wall clocks; the VM controller and the scheduler before it)
wait seen → the attempt that started it (a Waiting start and its retries)
unwind an earlier failed start's taps withdrawn (#100)
lock waiting on the disk lock, which the orphan sweep holds while it runs (#75)
seed, keys, owner the cloud-init Secret, the accessCredentials Secrets (#92) and the VirtualMachine read
disks every disk found or cloned or made, and attached; each also as disk/<name>
network the pod network (#88): sandbox and CNI ADD; ~0 for a VM on a node bridge
resume a restore's saved state prepared (#251)
window waiting for the deposit window: another start's taps (#100)
launch taps, plan and the engine's spawn
record identity published, the registration rewritten with the handle
control the hypervisor's control socket taking a connection (#303, #325), at most 10 s, tried every 5 ms for the first 100 ms, then every 25 ms to 1 s, then every 100 ms; the hypervisor's exit ends it early
report the Running status patch
total seen → Running answered

A VMI reads Running only once its hypervisor's control socket (QMP for qemu, the API socket for cloud-hypervisor) takes a connection (#303). Before, it read Running at the engine's spawn, and a client acting on it at once (a snapshot, a /vmVerb, hotplug) found no socket. The kubelet connects and closes; it does not wait for qemu's QMP greeting, which comes from qemu's main loop about 20 ms after the bind (#325), so a client acting on Running may wait that long for it. A hypervisor that runs but takes no connection within 10 s is reported Running anyway, with a Warning ControlNotReady Event that names the error.

attempts counts start attempts. The Started Event is queued after Running, not awaited before it (an Event POST took 0.5–0.7 s on a busy apiserver).

Components and runtime selection

Component Source Current role
kubelet cmd/kubelet, pkg/kubelet Node registration, Pod lifecycle, probes, storage, logs, metrics and stormvm VMIs
kube-proxy cmd/kube-proxy, pkg/proxy iptables Services/Endpoints (polled every 5 s), TLS + ServiceAccount token to the apiserver (#145). No stormcos edition starts it: Cilium owns Services in the Cilium edition, flowsdn in the flowsdn edition (owner, #145; stormcos#265, flowsdn#292). It stays in the golden for anything that runs it later
CNI library pkg/cni Standard plugin invocation and networking helpers

The executable defaults to --runtime stormpump, PID 1's engine over its ring (the stormcos stage recipe gives it at /hostrun/stormpump.sock). --runtime cri selects an external CRI v1 runtime (CRI-O or containerd); it is optional. These are the only two. The node-wide microVM runtime (--runtime vm, --vmm) is retired (#13, the owner's choice): microVM Pods are stormvisor's, picked per Pod by runtimeClassName (#204), beside stormpump Pods and stormvm VMIs on one node. The libcontainer runtime (--runtime native) is retired too (#442): it never unpacked the pulled image, set no namespaces and read no image config, so it could not run a container.

Pods on both runtimes move by evacuation (deleted and rescheduled). A rustkube.io/migrate-action annotation on a Pod ends as checkpoint-failed with the runtime's reason in rustkube.io/migrate-error; there is no checkpoint/restore of a Pod's processes. stormvm VMIs live-migrate (#40).

runtimeClassName (#204) is resolved to its RuntimeClass's handler before the sandbox. A RuntimeClass that does not exist is a wait (RuntimeClass "x" not found, a FailedCreatePodSandBox Event), as upstream; the pod is never run on the default runtime instead. --runtime cri passes the handler as CRI's runtime_handler (and crictl's --runtime). stormpump serves its default and realtime-soft/realtime-hard (below), and refuses any other handler with the reason: stormvisor's dispatch is not built, so a stormvisor Pod waits saying so rather than running as a container.

For stormpump Pods, CNI configuration is checked per sandbox: the kubelet passes the sandbox network namespace to CNI ADD and invokes DEL when the sandbox stops. A Pod that finishes (restartPolicy Never or OnFailure, every container terminated for good, Succeeded or Failed) has its sandbox stopped in that pass, so its address goes back to the CNI at once; its container records, status and logs stay until the Pod object is deleted (#137). What the CNI ADD returned is written on the Pod as k8s.v1.cni.cncf.io/network-status (Multus's shape: name = the conflist, interface, ips, mac, mtu, default, dns, gateway; plus addresses with prefixes, routes, plugins), with the start timing, once Running is acknowledged (#131). An MTU the plugin does not report is read inside the pod's namespace. What the node owns for networking and what the CNI (Cilium via network-operator) owns, and why a node with no gateway is never "the CNI is not up yet", are in node networking (#32). A Pod with no CNI configuration yet waits Pending ("network is not ready") without a sandbox: the config is checked before one is acquired, and the kubelet watches --cni-conf-dir (inotify), so the Pods waiting on it are started as soon as the agent writes its conflist (10 s fallback where the directory cannot be watched). A failed ADD (the agent not serving yet) is retried on a backoff from its own first failure, 1 s at first (#148). Host-network Pods, the CNI agent's own among them, bypass this. CRI delegates networking to the external runtime. Node Ready is not gated on the CNI (owner, #3: "we want to get working early"): the node is Ready once the kubelet is up, a pod-network pod waits for the config and then for a working ADD, and host-network pods start at once. A waiting pod says why on its containers and in an Event: NetworkNotReady with no config, FailedCreatePodSandBox with the plugin's own words when ADD fails (Cilium's "unable to connect to Cilium agent … Is the agent running?" with the agent gone). The CNI ADD runs with the sandbox's netns and K8S_POD_NAMESPACE/K8S_POD_NAME/K8S_POD_INFRA_CONTAINER_ID, its address is the pod's IP, a failed ADD is DEL'd and never leaves a pod addressless, and DEL runs at stop (verified live on server3, 11.91, #3).

Every container runs on its own root on stormpump (#104, the owner's rule): a copy-on-write clone of its image's sealed golden, made when the container is created (engine volume ctr-<container>, attached over ublk, mounted by PID 1 at /run/stormpump/roots/<container>), writable, and detached and deleted when the container is removed; a restart is a new container with a fresh clone. Container ids carry a mark of this kubelet's start (ct-<run>-<n>, #288), so a root is never named like an earlier boot's; the start-up sweep deletes only roots of earlier starts that nothing holds (not attached, not in use), reads what it has after the engine's listing, and never touches this start's own. Containers never share a root, and one layer sits between the golden and what the workload writes. A pallet image's golden is the slab's <volume>.golden (else the mounted volume's sealed parent). The volume is the one the engine reports mounted at /p/<path> (#231), else the one the node's mount list names: the root volume's /etc/stormblock/mounts since stormcos#259, or rd.stormblock.mount= on older releases (on the line it wins); only then the path's own name. A golden with nothing mounted at its path runs the same way (#294): when /etc/stormblock/carried (one <vol>:/p/<image> per line, the mount list's grammar; the initramfs never reads it) or the mount list names it and the engine holds it sealed, the pull needs no mount and no registry golden, each container's root is a clone by volume name, and argv[0] and user names are read from that clone. A name no list has is never looked for in the engine (its slab also holds blanks such as fastetcd-data.golden), so other images cost no listing; a listed golden the slab does not hold goes to the registry; an engine that does not answer is ErrImagePull, retried. A pulled image's is the fstemplate sbregistry sealed for it, so a pull clones nothing: it finds the golden record (GET /v1/goldens/{image}, ready, template_name) and answers template:<name>. An image this node's registry has no golden of is asked of the cluster (#79): the kubelet posts sbregistry's clone route, the one that starts its cluster fetch, and its answer (503 "fetching it from the cluster", 404 "push the image") is the pull's ErrImagePull, retried on the back-off; a clone it minted because the golden became ready meanwhile is deleted (stormblock-registry#98 would make that a plain demand). The demand names this node's NVMe host NQN (host_nqn, from /etc/nvme/hostnqn under /hostroot) when it has one, so a clone's export admits this host alone (#236, stormblock-registry#102, stormblock#212). A tag selects a golden version (#86): for a component the release manifest lists (or the node carries as a pallet), image: nextnfs:<sha12> (or nextnfs:golden-nextnfs-<sha12>) at a version other than the release's is not the pallet: it is pulled through the registry as registry/nextnfs:<sha12>, stormcentral's name for the golden golden-nextnfs-<sha12>. The registry's record gives the template each container's root is cloned from; a version this node does not hold is the cluster demand, which fetches it from forge once and keeps it (the owner's choice A; the fetch is stormblock-registry#116), retried on the pull back-off meanwhile. So an operator rolls one instance to a new golden, and back, with no node reboot. The release's own version, an untagged image, any other tag and any digest run the pallet, as upstream images with tags and @sha256: pins always did. Building an image from upstream on demand (POST /v1/goldens) is not done: whether that endpoint stays is stormblock-registry#50. A failed create or start removes the clone; roots no container holds (a kubelet that died mid-way) are deleted at start, never one still attached. readOnlyRootFilesystem mounts the container's own clone read-only once the engine can (stormpump#108); until then it is private and writable, and the kubelet says so. Per container start this is a clone, an attach and an ext4 mount (~0.4–1.3 s on 11.91; stormpump#107 has since made a warm ext4 mount ~5 ms on 11.95, stormblock#327 is the clone).

The image's config is applied under the pod spec on stormpump (#98), as a CRI runtime does. When an image resolves (a pallet or a pull), the kubelet asks sbregistry for its golden record (GET /v1/goldens/{image}, 2 s bound; a miss is asked again after 5 min) and keeps its config: command replaces the image's Entrypoint and args its Cmd (args alone run after the Entrypoint); the image's Env is under the pod's env; WorkingDir applies when workingDir is unset; User (a number or a name from the image's /etc/passwd//etc/group) when runAsUser/runAsGroup are unset. runAsUser, runAsGroup and runAsNonRoot (container, else pod) are applied (every container ran as root before). PATH and HOME default when neither side sets them; argv[0] is looked up on the container's PATH. The node's boot goldens carry no config yet (stormblock-registry#58): a container of one whose argv would be empty or start with a flag is refused, naming the image, instead of exec'ing the flag. emptyDir volumes are 0777, as upstream, so a non-root uid can write them. An image's declared Volumes (the registry records them since stormblock-registry#58) are made as CRI-O's default image_volumes = "mkdir" makes them (#172): a directory in the container's own root for each path no pod mount covers (at it or above it). Since #104 that root is the container's private writable clone, so what the image has there is kept and it goes with the container; the walk never follows a symlink, and one on the path (or a file) leaves it unmade with a warning. With readOnlyRootFilesystem it is writable only while the root is (stormpump#108).

The release's one stormd (#465, stormcos#822, stormcos docs/STORMD-SHARED.md): on stormpump, a container whose own root has a /.stormd directory (a real directory, not a link) gets the node's stormd image bound there read-only, so it sees /.stormd/bin/stormd and cannot write it. The image is where the node's mount list mounts the engine volume stormd (stormd:/p/stormd → /pallets/stormd), else /pallets/stormd. Each container of a pod is decided by its own root. A pod volume at /.stormd wins. A root without /.stormd gets no bind. A node with no bin/stormd there gets no bind and a warning naming the path, and the container runs as before on the image's own /stormd. The CRI runtime gets no bind: the kubelet cannot see a CRI image's root.

Capabilities (#118, stormpump#47's Spec.caps): a container gets the runtime's standard 14 (Docker's, containerd's and CRI-O's: CHOWN, DAC_OVERRIDE, FSETID, FOWNER, MKNOD, NET_RAW, SETGID, SETUID, SETFCAP, SETPCAP, NET_BIND_SERVICE, SYS_CHROOT, KILL, AUDIT_WRITE), minus capabilities.drop, plus capabilities.add (drop first, so drop: [ALL] + add keeps exactly the added ones); allowPrivilegeEscalation: false sets no_new_privs. A privileged container keeps every capability (its add/drop ignored, as upstream). An unknown name fails the container's create, naming it. Before this every stormpump pod ran with the full set (the engine's default, a node service's); a release with it needs stormpump accd1a3e8e61 or later (Spec.caps). The CRI gRPC path forwards add/drop and no_new_privs to the runtime.

fsGroup and supplementalGroups (#171). The pod's fsGroup and then its supplementalGroups (each once) are the container's supplementary groups (stormpump's Spec.groups, set with setgroups before its gid and uid; an exec gets the same). A claim's filesystem is given to fsGroup before the container starts, as upstream's kubelet does: PID 1 mounts it at /run/stormpump/pvc/<dev> (the kubelet sees that mount), and the tree's group becomes fsGroup, files gain group read-write (read-only 0440 on a read-only mount), directories group execute and setgid, and symlinks are left alone. fsGroupChangePolicy: OnRootMismatch walks nothing when the root's group and mode are already right; the root is changed last, so a walk that failed is walked again (#448). The walk never follows a path inside the volume: each entry is opened from its parent's descriptor with O_NOFOLLOW and changed through its own descriptor, so a pod swapping in a symlink cannot point it at the node's files (#448). A change that fails fails the start, naming the path. emptyDir is 0777 and configMap/secret files keep their own modes, as upstream. The CRI gRPC path sends fsGroup and supplementalGroups as the container's supplemental_groups.

Kubernetes 1.36 posture (#23, the control plane's since rustkube#37): nodeInfo.kubeletVersion is v1.36.0-rustkube+<apimachinery> and kubeProxyVersion is not reported (1.33 removed it). A pod that asks for an AppArmor profile other than Unconfined (pod or container securityContext.appArmorProfile, or the old container.apparmor.security.beta.kubernetes.io/<c> annotation) is refused as upstream refuses it on a node that cannot enforce one: Failed, reason AppArmor, a Warning Event, nothing started (no runtime here applies a profile). A gitRepo volume waits with a message naming its 1.36 removal (clone from an init container into an emptyDir). With --runtime cri, containerd before 2.0 stops the kubelet at startup (1.36 dropped containerd 1.7); CRI-O is not checked. cgroups are v2 only; kube-proxy has no IPVS mode.

The 1.36 API's pod status (#275). Each status write carries observedGeneration (the pod's metadata.generation it was made from) on the status and on every condition, each app container's and sidecar's allocatedResources (requests) and resources (requests and limits), and the pod's status.resources when the spec has pod-level resources. In-place resize (/resize) is not done yet, so the reported resources are the spec's. The kubelet holds no k8s-openapi or kube types of its own (every object is JSON); its k8s-openapi comes through rustkube's apimachinery and moves to 0.28/v1_36 with rustkube#285.

Container status and image provenance (#130). A container that ended carries upstream's state.terminated.reason (the runtime's, e.g. OOMKilled, else Completed for exit 0, Error otherwise) and message; once it is restarted (or while it backs off) its previous run is lastState.terminated (exit code, reason, start and finish), forgotten with the pod. On stormpump a container's imageID is its image's sha256:: the registry record's manifest digest for a pulled image, the release manifest's golden digest for a pallet (else the reference, as before). Each container's provenance is on the pod as annotations, written with the start timing and again after each restart: storm.io/image-resolved.<c> (when its golden was last checked and cloned for it), storm.io/instance.<c> (the engine volume that is its own CoW root), storm.io/golden.<c> and storm.io/image-build.<c> (JSON: OCI created and org.opencontainers.image.* labels once the registry keeps them, stormblock-registry#100; a pallet's release provenance/version). A node service's mirror pod carries its golden's digest as imageID, storm.io/golden and storm.io/golden-provenance from the release manifest, and hostIP.

Traceability (#372). Every container root (ctr-ct-*) is created with stormblock's owner {kind: Pod, namespace, name, uid, container}, so the engine's listing names the pod and container it belongs to. A pulled image's root sets it right after the clone, as PUT /volumes/{id}/owner {"owner": …}; before this, the bare owner cleared it and every pulled container's root read unclaimed. The root is deleted with its container, and the sweep deletes any ctr-* root that no live container holds. A built-in claim's volume is owned by its PersistentVolumeClaim (namespace, name, uid). The pod also carries storm.io/image-digest.<c> and storm.io/volume.<name> (the engine id of each claim it attached, or another driver's handle). The chain pod → container → image → root clone → golden is on the object. A node service's mirror pod declares what the engine says the service runs on: its root clone as volume root (a hostPath of its mount), its <svc>-data/-state/-logs as volumes of those names (its node claims), volumeMounts where they are mounted, and storm.io/instance.<svc>, storm.io/golden.<svc> and storm.io/volume.<name>. An existing mirror pod is patched when these differ, and made again if the apiserver will not patch its spec. A static pod's mirror (etcd's) carries storm.io/volume.<name> for each hostPath: the engine volume mounted at that path, the host's symlinks followed (/data → /d), or at the deepest directory above it (#395; a volume at / names nothing). /stats/summary lists each pod's volume[] with the same ids, hostPaths left out.

Node allocatable and cgroups (#24): allocatable is upstream's, capacity less --system-reserved, --kube-reserved and the hard-eviction line (memory 100Mi, nodefs 10%); it was a fixed capacity − 256 MiB. With --runtime cri each sandbox gets upstream's per-QoS kubepods cgroup parent, spelled for the runtime's cgroup driver (its RuntimeConfig, else --cgroup-driver, else cgroupfs). stormpump keeps its own Pod groups (#57).

An init container runs until it exits (#126), as upstream: there is no fixed bound (it was 120 s, then DeadlineExceeded), and its wait holds no worker (its exit is an event). The pod's activeDeadlineSeconds, counted from its startTime, is the only deadline: past it the init container is stopped and reported DeadlineExceeded and the pod is Failed. A running pod's activeDeadlineSeconds is not enforced yet (#185).

Native sidecars (initContainers[].restartPolicy: Always, #111) run as upstream runs them: started in their init slot, the next init container goes once the sidecar has started (running, and its startupProbe passed if it has one), not when it exits, and there is no init deadline for it. It then runs for the pod's life: probed like an app container, restarted whatever the pod's restartPolicy (an exit before it started is a restart with back-off, never a failed pod), reported in initContainerStatuses with started, ready and restartCount, and counted in Initialized (once started) and ContainersReady/Ready. It does not count toward the phase: a Never/OnFailure pod finishes with its app containers, and its sidecars are stopped then, last declared first. On deletion the app containers stop first, then the sidecars in reverse order.

An overview deck is docs/presentation.md (Marp). See configuration and defaults, ports and APIs, and build and shipping. The binaries share upstream names; this does not establish full upstream compatibility.

The kubelet API (:10250)

HTTPS, bearer-token auth (a static token, or one the apiserver accepts via TokenReview, its answer kept 2 min, a refusal 10 s; an apiserver that cannot be asked within ~6 s makes the request 503, #244); /healthz, /livez and /readyz are open.

Route What it is
GET /metrics, /metrics/cadvisor Prometheus metrics under upstream's names: the kubelet's own, and cAdvisor-shaped container and pod usage. See docs/metrics.md
GET /stats/summary Partial Summary API: container CPU/memory, the node's own CPU and memory from the cadvisor library (root cgroup CPU; usage, working set, available, rss and page faults as cAdvisor computes the root; the container sums only when unreadable, #21), node filesystem usage (no rootfs usage for a stormpump container, #222), each pod's network (bytes, packets, errors, drops per interface, #131) and volume[] (name, pvcRef, volumeId, the engine's capacityBytes/usedBytes, #372); not full metrics-server/HPA conformance
GET /pods The pods this kubelet manages, including admitted pods still waiting to start (Pending, with the reason)
GET /containerLogs/{ns}/{pod}/{container} What kubectl logs reads, by way of the apiserver proxy. Each container (init containers and native sidecars too) has its own directory, /var/log/pods/<ns>_<pod>_<uid>/<container>/, and each run of it its own file, <N>.log: a restart, a retried init, a restarted sidecar or a run after a kubelet restart takes the next number, so --previous is the run before (previous=N, N back). The current run and five previous are kept (upstream keeps one); older ones go when a new run starts. The live file is rotated as upstream's ContainerLogManager does: every 10 s, past --container-log-max-size (10Mi), to <N>.log.<YYYYMMDD-HHMMSS>, older rotations gzip'd, at most --container-log-max-files (5) files per run; kubectl logs reads the live file. stormpump holds an O_APPEND descriptor and has no reopen, so rotation copies then truncates (a line written between the two is lost), and its files carry the raw output: no timestamps or stream per line, so timestamps and since have nothing to act on there until stormpump writes CRI-format lines (stormpump#129); a CRI runtime's files are served with both (#216). A pod waiting to start answers 400 … is waiting to start: ContainerCreating (<reason>), as upstream does. A node service's mirror pod (<namespace>/<asset>-<node> in its --mirror-namespaces namespace, #418, container <asset>) reads the service's stormd log volume, found through the boot unit that mounts it at /var/log/stormd and seen under /hostroot. The current log covers every process stormd runs there, rotations included, merged in time order and marked [<proc>] when there is more than one. --previous is the newest finished run (.failed.log or .exited.log: upstream's last terminated instance, #216; it was the newest .failed.log only), and tail, since, timestamps, limit and follow all apply. A service not run by stormd (stormblock, registry, timesync) is read from PID 1's own file for its running incarnation: /run/stormpump/assets.json lists each asset's last five runs (stormpump#90), each naming its w<id>.log (and w<id>.1.log, the rotated start) under /run/stormpump/logs; follow polls the live file. --previous is then the newest ended run's file (#87). When there is no such file either (the service died before stormd wrote its volume, an older PID 1), the log is PID 1's record of its last exit: last_output, the last 20 lines its incarnation wrote (stormpump#51); --previous falls back to it too. PID 1's lines have no timestamps, so only tail and limit apply. With none of these, a 404 (400 for --previous) names the volume looked in and the last exit or refused start (#124)
GET /logs/journal, GET /logs/{path} What oc adm node-logs reads through the apiserver's nodes/proxy (#198, rustkube#108). stormcos has no journald, so /logs/journal is the node services' own logs (their stormd log volumes; PID 1's run files for a service stormd does not run), merged in time order and written as journalctl writes them: oc adm node-logs n1, -u fastetcd, -u kubelet (a stormd process), --since -1h, --tail 50, --grep, --boot 0, -o json. /logs/ lists the host's /var/log and each service's log directory (oc adm node-logs n1 --path=/, --path=fastetcd/etcd.log). See docs/api.md for every option
POST/GET /portForward/{ns}/{pod} kubectl port-forward (#56). Upgrades to SPDY/3.1 (X-Stream-Protocol-Version: portforward.k8s.io) or to a WebSocket tunnelling SPDY (Sec-WebSocket-Protocol: SPDY/3.1+portforward.k8s.io, what a newer kubectl tries first). Each forwarded connection is an error + data stream pair by requestID; the kubelet connects to localhost:<port> inside the pod's network namespace (IPv4, then IPv6; the node's for a hostNetwork pod) and splices; a failure is written on the error stream. Anything else is refused before the upgrade (404 unknown pod, 403 another protocol), which is what makes client-go fall back from WebSocket to SPDY
POST/GET /exec/…, /attach/… kubectl exec and kubectl attach over SPDY (v4.channel.k8s.io and older) or a WebSocket (v5.channel.k8s.io, v4), see exec and attach
GET /vmConsole/{ns}/{name}/{door} A VM's serial or vnc console, answered by stormvm's console router mounted here (vnc for qemu, and for cloud-hypervisor's stormvm display helper when vmm: cloud-hypervisor is named, stormvm#1)
GET /vmInstance/{address} VMI metadata by observed guest address (an index, not a scan); answered only when the cached VMI places the machine on this node (status.nodeName, a completed migration's target), so a moved machine or a reused address is 404 here (#119). A node address (host-network workload) answers only with the workload's ServiceAccount token in X-Storm-Workload-Token, for the pod it is bound to, if that pod runs here (#122). Cold cache returns 503 with Retry-After, and so does a machine here when the apiserver has not been heard from (renewed node Lease or VMI list) within --metadata-max-staleness, 40 s (#156); absent guest returns 404. stormimds asks this route on every guest request (stormimds#12, decided; details in docs/api.md); SSH keys and user-data are not in the answer yet (#168)
DELETE /volumes/{ns}/{claim} Delete the stormblock clone behind a released claim

The console and volume-release routes exist here because what they reach is on the node and the control plane cannot get to it. Routing through the kubelet keeps the blast radius at one node and reuses a hop the apiserver already authenticates, rather than handing a controller credentials to every node's engine.

They reach it two different ways, and the difference is worth knowing. DELETE /volumes dials stormblock, which serves its management API on 127.0.0.1:9090 and is a separate engine with its own lifecycle. The console is mounted: stormvm-console is a library that hands back an axum::Router, so the doors run inside this process and the last hop is a function call. There is no standalone node — every node runs rustkube, so every node with a VM on it already has a kubelet, and a second long-lived process whose only job was to serve consoles was one that never needed to exist. Mounted here the doors also inherit this server's TLS and bearer auth instead of stormvm's weaker "loopback, or a token" rule for an unauthenticated node-local port.

The mounted router is told where this node's stormblock engine is (the kubelet's --stormblock, default http://127.0.0.1:9090), so its snapshot verb can take a VM's disks as one group snapshot; it finds the engine token itself, in the same places the kubelet does. Its verbs are on :10250 too (#94): PUT /vmVerb/{ns}/{name}/{verb}, for pause, unpause, softreboot, reset, status, freeze, thaw (KubeVirt's unfreeze is accepted for it) and snapshot, its query (name, quiesce) forwarded without any token, behind this server's auth exactly as the doors are. migrate/receive are not offered: a migration is driven by the VMI's status (#40). The apiserver's subresources.kubevirt.io verb proxy is rustkube#141.

stormvm serve mounts the same router on 127.0.0.1:9095, and it ships: stormcos runs it on every node as a service golden (stormvm, port 9095, loopback only; stormcos deploy/build-goldens.sh, serve --addr 127.0.0.1:9095 --run-dir /run/stormvm), and stormconsole's VM plugin reaches the serial and VNC consoles through it ([vm] url = http://127.0.0.1:9095, stormconsole crates/plugins/vm/src/console.rs). It reads the same /run/stormvm registrations this kubelet writes, so both doors answer for the same machines. From outside the node the apiserver's vmConsole proxy to :10250 (above) is the way in; :9095 is the node-local one (#123, stormcos#65).

exec and attach

kubectl exec (#56) runs the command inside the running container through stormpump's exec op (stormpump#103): a SPAWN with the container's workload in inline_a, so the process is in its namespaces, at its root and in its cgroup, with the container's environment, working directory, user and capabilities (#118). A relative command is looked up on the container's PATH in its root, as at start. Its stdio is descriptors the kubelet deposits on the engine's socket and keeps the other ends of: a pipe per stream asked for, or one pty (kubectl exec -t) on all three, resized from the session's resize stream. No stream data goes through the ring. The process's exit reaches the session alone (not the node's exit queue, so an exec probe wakes nothing else), and its exit code becomes kubectl's. Exec probes (exec_sync) are the same op: stdout and stderr kept to 1 MiB each, past timeoutSeconds it is stopped and the probe fails.

kubectl attach reaches the container's own stdio. A container with stdin: true gets a pipe on its fd 0, deposited at start, whose writer the kubelet keeps for its life; its output still goes to its log, and an attach follows the log file from that moment (a copy-truncate rotation is followed too). A container with tty: true gets a kubelet-held pty on 0, 1 and 2: the kubelet copies what it writes into the container's log and to everyone attached, and kubectl attach -it gets the terminal, resizes included. (The engine's own tty is the node's console, one per node; a tty: true pod used to take it.) Detaching leaves the container running.

The transports and the wire format are in docs/api.md. The CRI gRPC path (a containerd or CRI-O runtime) has no exec or attach here: its runtime streams through its own server, which this kubelet does not proxy.

DELETE /volumes is what makes reclaimPolicy: Delete finish instead of leaking: 204 when the clone is gone or was never there, 409 while a pod on this node still has the claim, 503 when the node cannot establish that it is unused. It never answers 204 on a guess — the volume name is derived from the claim's, so a PV deleted over a surviving clone would let a later claim of the same name in the same namespace adopt the previous tenant's data.

Static pods and their mirror pods

Each manifest in --pod-manifest-path (stormcos#559: etcd, kube-apiserver, kube-controller-manager, kube-scheduler from /run/kubernetes/manifests) runs as a pod named as upstream names it, <name>-<node> (uid static-<name>-<node>), and is published in the API as its mirror pod (#258): the same pod, annotated kubernetes.io/config.mirror and kubernetes.io/config.hash (the manifest's SHA-256, first 16 hex digits) and kubernetes.io/config.source: file, owned by the Node (made once the Node is registered). The kubelet writes the mirror's status from the static pod's containers and probes (phase, containerStatuses with restarts, Ready), so get pods -n kube-system, describe and logs (pods/log reaches the static pod by that name) show the control plane. A deleted mirror is made again; one whose hash is not its manifest's (the manifest changed) is deleted and made again; one whose manifest is gone is deleted. Only after a complete read of the manifest directory: a failed read deletes nothing. A mirror pod is never run (it carries kubernetes.io/config.mirror); its static pod is.

The node's services as pods

When PID 1's asset table (/run/stormpump/assets.json) changes, and when a mirror pod is edited or deleted, the kubelet mirrors each asset as a read-only pod, <namespace>/<asset>-<node> (labels storm.io/asset, storm.io/component=node-service). Each service in its own project (#418, stormcos#1020): the namespace is the asset's in --mirror-namespaces (/etc/kubernetes/mirror-namespaces.json, {"stormblock": "storm-block", …}, shipped by stormcos), else kube-system. The map is read again when it changes. A mirror is created only into a Namespace that exists (the projects come from manifests.d; until then the pass retries and any old mirror stays). A mirror of the same asset left in another namespace (kube-system, from before) is deleted once the new one exists, so there is one pod per asset. Its events, stormd's events and containerLogs follow it, and so do the service's system claims (docs/node-volumes.md), since a pod's persistentVolumeClaim names a claim in its own namespace. The kubelet never runs one (#249): a pod carrying any of the mirror's marks (kubernetes.io/config.source: stormpump, storm.io/mirror: true, the node-service label, or a stormpump://<asset> image) is left out of the pods it runs, from the API and from static manifests alike, and a stormpump:// image is refused by the image service rather than resolved to the pallet its last component names (run as a pod, stormpump://sshd would be a second sshd on the host network beside PID 1's, stormcos#547). Its startTime is now less the service's age: the node's uptime (/proc/uptime) less PID 1's started_secs (the same CLOCK_BOOTTIME), which holds still while assets.json is written only on a change (stormpump#67); an older PID 1 without it gives age_secs (#193). A running asset's pod is Running and Ready, and a stopped one is Failed. A service run by stormd shows what stormd's own supervision says (#215, stormd#48): every 5 s the kubelet asks each host-network service's stormd (its [api] bind port from the golden's config: 9081 fastetcd, 9082–9084 the control plane, 9085 rustkube-node, a service's port + 100) for GET /api/v1/processes. Helpers are containers of their own (#378): every process stormd marks helper ([[process]] helper = true, stormd#80; a log shipper, a cert client that renews) and that is not a one-shot gets a container of its own after the service's, named after the process, with the service's image and golden imageID, its own status as below, and storm.io/instance.<process> (the service's root clone: a service's processes share one root and one mount namespace). Its volumeMounts are the goldens stormd presents to that process (GET /api/v1/volumes, stormd#75: the one volume fact that is a process's own), each declared read-only as an inline volume of the built-in driver (stormblock.storm.io, volumeAttributes.volume_id); a golden not presented has no mount. The pod is Ready only when every container is, and its Ready condition names the ones that are not. A name does not tell a helper (rustkube-apiserver's main process is apiserver, beside a long-running stormcert signer): with nothing marked, which is every service until stormd reports the flag, one container stands for them all. The service's container is its long-running processes (#226): one-shots (a [[process]] with on_exit = "stop" or restart_policy OnFailure/Never in the golden's stormd config, or any process stopped after exit 0, such as the stormcert-client-* cert minters) are init-like and never decide it. Of the long-running processes, the one named after the service speaks for the state, else the worst of them; restarts are theirs, summed; ready only when every one is, and a not-ready container's Ready condition names the processes (or a one-shot that failed, which also keeps it not ready). So: Running since its start, Waiting CrashLoopBackOff while stormd backs off, Waiting ContainerCreating while it starts, Terminated with its exit (Completed/Error) once stopped; restartCount is stormd's restarts plus PID 1's; a restarted process carries its last exit as lastState.terminated; Ready is its readiness probe, and not ready gives upstream's ContainersNotReady conditions (the pod stays Running, as upstream's does while a container restarts). stormd's Kubernetes events (GET /api/v1/events?since=<seq>: Created, Started, Unhealthy, Killing, BackOff) become Events on the mirror pod (involvedObject.fieldPath the container, named by the event's identity so stormd's count/lastTimestamp bumps patch the same Event, and a kubelet restart re-reading from 0 doubles nothing). A stormd whose [api] asks for TLS or a credential (stormd#32) is not read (said once): its mirror keeps PID 1's view below. Without stormd's answer, ready means it answers (#96): for a host-network service the kubelet runs the probe its golden's stormd config declares (the golden is the boot unit's root volume, under /hostroot; #219): from the [[process]] named as the service first, the first of [process.readiness_probe], [process.liveness_probe] (stormd#48's Kubernetes fields: http_get = {path, port, host, scheme, http_headers} is a GET, 200–399 an answer, no redirects, any certificate; tcp_socket = {port} a connect) and the retired [process.liveness] type = "http", url = …, on the probe's own period_seconds, timeout_seconds, failure_threshold and success_threshold (stormd's defaults 10 s, 1 s, 3, 1; the old table 10 s, 2 s, 3). failure_threshold failures in a row make the pod Running but not ready: container ready: false, Ready/ContainersReady False, reason Unhealthy with the failure, and an Unhealthy Warning Event; success_threshold answers make it ready again. A node service's exec or grpc probe is not run from the kubelet (said once in its log; a Pod's exec probe is, #56). A service with no probe the kubelet can run, or not on the host network, is Ready while running, as before. A service that has exited says how (#82): PID 1 keeps each asset's last exit in assets.json (last_exit_code or last_exit_signal, last_exit, the last 20 lines of last_output; stormpump#51), and the mirror's container carries it as lastState.terminated (exitCode, 128 + the signal when a signal ended it, signal, reason Error, message = the output's tail within upstream's 80 lines / 4 KiB). A service that stays down has the same on state.terminated; one that never exited invents no exit code. Its lifecycle is Events on the mirror pod (#50): Started (with the service's own start time), Stopped, Failed (a non-zero exit or a signal, Warning), BackOff (PID 1 restarted it), the last three ending with the exit and that tail. First sight is judged against the mirror pod the API has, so a service started since it was last written is announced and a kubelet restart re-announces nothing. For a service run by stormd the output is stormd's own until stormd#29. A mirror whose asset is not in the table on this boot (its unit was not started) becomes Pending, with its container waiting NotStarted, no startTime, and one Warning Event. It used to keep the previous boot's Running status. Mirrors are never deleted by the kubelet, and kubectl logs on them is described above.

Storage

The built-in stormblock PVC driver uses stormblock and sbregistry blanks. A claim is a copy-on-write clone of a sealed, preformatted size-class blank: no per-claim mkfs, data copy or CSI. The class's policy (#71): the StorageClass's parameters say how a new claim's volume is protected, as stormblock spells it (stormblock#151):

Parameter Values
redundancy none (default), mirror (= mirror:2), mirror:N, raid1, raid10, raid5:D+1 / raid5:N, raid6:D+2 / raid6:N, parity:D+P; an @rung suffix sets the spread copies or parity legs, each on its own failure domain
spread site building room row rack node hba shelf set bay drive (default drive) the rung the legs differ at; must agree with an @rung
tier hot warm cool cold fast a preference, never a refusal. A volumeMode: Block claim's volume is created on it; a filesystem claim's clone of its blank puts its own writes there, while what it shares with the blank stays where the blank is (#400, stormblock#377, engine v24.30.0). fast is a blade's SSD beside its system HDD (stormblock#672): nothing lands there unless a class asks

Any other key is refused on the claim (ProvisioningFailed), except csi.storage.k8s.io/* and the two stormcos's class has always carried, kind: clone and fsType: ext4 (#232: a class's parameters are immutable on a running cluster; other values of those two are refused). A class naming nothing is one copy and clones the shipped blank (pvc-ext4j-<MiB>m), as before (the design's default, stormblock's "owner decision 2", is still none). A policy gets its own blank per (size, fs, redundancy, spread), named for them (pvc-ext4j-1048576m-mirror2-shelf) and minted with redundancy/spread, so every claim cloned from it inherits the policy; a Block claim's raw volume is created with the policy and the tier. A policy the node cannot place on distinct domains is refused by the engine (409) and said on the claim as ProvisioningFailed with the engine's words. A StorageClass that cannot be read is a wait, never "none". Capacity (#62) charges a claim its class times its redundancy (a 2-way mirror twice), and counts committed volumes the same way. Only the class named stormblock is provisioned here (rustkube's provisioner matches the name too, #200); its parameters apply to every claim of it. Claims are cloned and attached over ublk by the node itself (pkg/kubelet/src/storage.rs), through the node's stormblock engine (--stormblock, default http://127.0.0.1:9090). The engine requires its own token, and the kubelet presents it on every call (pkg/kubelet/src/engine.rs). It reads the token from $STORMBLOCK_API_TOKEN, or else from the file at $STORMBLOCK_TOKEN_FILE (default /run/stormblock/engine/api_token, set by stormcos), then /etc/stormblock/api_token, then /var/lib/stormblock/api_token. The engine mints the token when it starts, and the kubelet may start first, so while no token is found the kubelet looks again on every call. After a 401 it reads the token again and retries once if the token changed. A change the engine refuses to the node token (a destructive verb under stormblock#274's admin gate, such as deleting a broken template) is sent once more with the admin credential from $STORMBLOCK_ADMIN_TOKEN or the file at $STORMBLOCK_ADMIN_TOKEN_FILE (the engine's admin token, or a ServiceAccount token its SubjectAccessReview allows), read at each use (#105). An https:// engine is verified against --stormblock-ca and nothing else (#312; see configuration). Every other StorageClass goes through its CSI driver. The kubelet registers node plugins from /var/lib/kubelet/plugins_registry, writes CSINode, and stages and publishes volumes. It will not give a pod a volume whose mount has not reached the node. See docs/csi.md. Each pod mount's mountPropagation reaches stormpump's spec (#81, stormpump#35): HostToContainer as rslave, Bidirectional (privileged containers only) as rshared. Real-driver mount/restart/delete acceptance remains #52.

A pod whose volumes are not ready waits, and says why. It is Pending, every container is waiting: ContainerCreating with the reason (for example waiting for volume pvc-default-data: template pvc-ext4j-1048576m awaiting_format), and describe shows a FailedMount Event. After 5 minutes the reason says it timed out, and the kubelet keeps retrying. As upstream, a mount timeout does not fail the pod, because the volume may still come. The same holds for the files the kubelet writes for a pod (emptyDir, configMap, secret and projected directories, the ServiceAccount token, resolv.conf and the container log directories): they are written before the sandbox, and a write the node refuses (a full disk, ENOSPC) leaves the pod waiting with the path and the errno, retried until there is room (#129). ConfigMap, Secret and projected volumes always mount read-only, whatever volumeMounts.readOnly says, as upstream does. Their files are written by replacing each one: a new file, created exclusively, is renamed over the key, so an existing entry is never opened or followed. A key's path must stay inside the volume (no .., no absolute path, no symlinked directory on the way) (#428).

A pod that cannot start says which container and why, as upstream does (#133). An image that will not pull is a wait: the containers are waiting: ErrImagePull, then ImagePullBackOff, and the pull is asked again after a back-off of as long as it has waited (10 s to 5 min). A container that will not be created waits as CreateContainerError, one that will not start as RunContainerError; either is tried again after 0.5 s, then 1, 2, 4 and 8 s, then on the 10 s – 5 min clock (#287, #289: the engine refusing a fresh root's attach or mount, or a claim's mount, once after a boot costs the apiserver half a second, not 10). Under restartPolicy: Never a container that will not start ends the pod instead: Failed with that container terminated StartError, exit 128. A start that got past its sandbox is torn down before the next try, and the try waits its back-off whatever wakes the pod. Anything else that ends a start (an init container that failed) leaves the pod Failed with its init statuses and its containers PodInitializing, never with no container state, and logs answers why (400), not "not found".

The image ships sealed blanks for the common classes (pvc-ext4j-<MiB>m, sbregistry's naming). A class with no blank is minted on its first claim: stormblock formats and seals it once (role: data). The mint runs in the background without an inline wait. Completion signals the Pod and VM queues immediately; waiting claims check the template's state and proceed when it is ready. A large format does not hold the reconciliation pass. A clone stormblock refuses leaves the claim waiting with stormblock's own answer (status and error, or "no answer within 60 s") in the pod's FailedMount Event and container message. A refusal that means the template itself is broken (its sealed volume missing or not sealed, or no sealed snapshot recorded) deletes the template and mints it again, so the next claim clones a sound one rather than meeting the same refusal forever (#140). A template the engine already lists as broken (a kept record whose sealed volume is gone, stormblock's broken reason) takes the same path before any clone is tried, with the reason in the claim's ProvisioningFailed event (template … is broken (<reason>); deleted; minted again); only awaiting_format, formatting, sealing and awaiting_seed wait, and a state the kubelet does not know is a ProvisioningFailed naming it, never a wait (#383). A clone refused because the template vanished after it was listed (fstemplate … not found; stormblock#663 deletes a template that is not whole) mints it at once (a Provisioning event) and clones when the mint wakes the claim. The claim itself says so (#70), with external-provisioner's reasons: a Normal Provisioning while its class's blank is minted or formats, a Warning ProvisioningFailed with stormblock's words when a mint or a clone is refused, and a Normal ProvisioningSucceeded once it is cloned (kubectl describe pvc; repeats aggregate).

Growing a claim (#379): a Bound claim of the class whose request is raised (kubectl patch pvc … -p '{"spec":{"resources":{"requests":{"storage":"8Gi"}}}}') is grown online by the node that holds its volume (pvc_resize.rs), in upstream's two halves and with their words. First the resizer: Resizing, allocatedResources and allocatedResourceStatuses.storage: ControllerResizeInProgress with a Resizing event, then the engine grows the volume (stormblock#655: PATCH /apis/storage.storm.io/v1/volumes/{id} spec.sizeBytes, the request rounded up to a MiB, thin, the ublk device told), then the PV's capacity. A Block claim is done there (VolumeResizeSuccessful). A filesystem claim is FileSystemResizePending / NodeResizePending (FileSystemResizeRequired) until its device is mounted on this node. Then its ext4 (EXT4_IOC_RESIZE_FS) or XFS (XFS_IOC_FSGROWFSDATA) is grown online to the device, the claim's status.capacity follows, and the event is FileSystemResizeSuccessful. A claim no pod mounts stays pending until one does, as upstream's does. The engine's refusal (a mirrored or exported volume: 409; a sealed one) is a VolumeResizeFailed Warning with its words, and ControllerResizeInfeasible until the request changes. The apiserver refuses a shrink, and refuses any grow unless the class says allowVolumeExpansion: true (stormcos#1032). The node's own service volumes are not grown here: they grow through their stormblock Volume object, and the claim mirror follows. A claim's size class is where it starts; it is no longer its ceiling.

Snapshots and restores (#379, pvc_snapshot.rs): with a VolumeSnapshotClass of driver stormblock.storm.io (stormcos#1032), the snapshot-controller turns a VolumeSnapshot of a claim into a VolumeSnapshotContent. The node whose engine holds the volume does the csi-snapshotter's part. It flushes (sync(2)), cuts a one-volume stormblock group snapshot named after the content (found again by name after a restart, never cut twice), marks the content storm.io/snapshot-node, and writes status.snapshotHandle (the group id), creationTime, restoreSize and readyToUse, with a SnapshotCreated event. A refusal is status.error (which the controller copies to the snapshot) and SnapshotCreationFailed. While it is cut the content carries upstream's volumesnapshot-being-created annotation. Deleting it follows the controller: once it marks the content volumesnapshot-being-deleted, a deletionPolicy: Delete content's group is deleted, a Retain one's is kept, and then the controller's volumesnapshotcontent-bound-protection finalizer comes off. A claim with dataSource (or dataSourceRef) {apiGroup: snapshot.storage.k8s.io, kind: VolumeSnapshot, name: …} is restored as a new volume from the group, at the snapshot's size, and grown to its request once bound. A request below restoreSize is refused with upstream's words. The snapshot must be ready, and its pod must run on the node that holds it (a snapshot is in one node's storage, like the claim it was cut from). A dataSource of kind PersistentVolumeClaim clones a claim, as before.

describe pvc: a built-in claim's PV names the engine's volume id in its CSI source (volumeAttributes["storm.io/volume-id"], beside the handle, the volume's name; stormblock#649). The claim's events are provisioning (above), Restored, the resize events and the snapshot events (on the content). Used By is kubectl's own, from the pods.

The ladder is 1Mi, 16Mi, 64Mi, 256Mi, 1Gi, 4Gi, 16Gi, 64Gi, 256Gi, 1Ti, 4Ti, 16Ti, 64Ti, 256Ti, 1Pi (#67); requests round up, and requests above 1Pi are refused. The rounded class is the volume's starting size (a claim grows past it, above). Each class names its filesystem (storage.rs SIZE_CLASSES); all are ext4 (owner, #67; stormcos#91 found nothing that forces XFS), 1Pi included (#149): stormblock carries mkfs-ext4 v4.1.1 since golden-stormblock-12891c0025b2 (stormblock#289: the streaming format of mkfs.ext4.rs#10 and the inode count of #9), which on a build VM formats and seals a 1 PiB template in 1016 s at 1.6 GiB peak (64 TiB in 264 s). A class blank is minted once per node, under the hour MINT_TIMEOUT; the claim waits on it like any mint. A claim is still charged its class at bind (#108), so a node only takes one its data slab has room for.

Raw block claims (volumeMode: Block): a plain thin stormblock volume of the class's size (POST /api/v1/volumes, role: data; no template, no mkfs), attached over ublk like any claim, and bound at the container's volumeDevices[].devicePath as the device itself (no filesystem). A Block claim named in volumeMounts, or a Filesystem claim in volumeDevices, keeps the pod waiting with the reason. A devicePath under /dev needs stormpump ca2fece or later (12.64 on): before it, the default /dev tmpfs covered the bind and a write made a regular file there (stormpump#222). The PV's volumeMode follows the claim when the node writes it; the control plane's provisioner writes Filesystem until rustkube#201. A VM disk naming a Block claim gets the raw volume. Raw block from third-party CSI drivers is refused (docs/csi.md). Sizes go to stormblock as <MiB>M, since it has no P suffix.

Room on the data slabs (#62; policy #108, pkg/kubelet/src/capacity.rs). A claim is a thin clone, so nothing physical stops a slab filling under many large claims. So a claim is charged its full class size when its volume is made (a 600Gi claim takes 1 TiB of room: the class is what it can write), clones keep the class size, and the overcommit ratio is 1.0:

  • Room = min(data total × --storage-overcommit − committed, data free) − reserve, where committed is the virtual size of every writable data-role volume (claims, node service volumes, VM disks; not goldens, sealed volumes or the class blanks: stormblock's fstemplate-* volumes, still formatting or sealed, #209; not containers' roots, ctr-*, which are ephemeral like upstream's writable layer and bounded only by data free, #379) and reserve is --storage-reserve-percent (5) of the data slabs.
  • Published: CSIStorageCapacity kube-system/stormblock-<node> (class stormblock, topology kubernetes.io/hostname), capacity = the room and maximumVolumeSize = the largest class that fits, on engine volume changes and every 60 s. rustkube's scheduler compares a claim's request with it once the CSIDriver says storageCapacity: true (stormcos#151).
  • Refused at provision too (static pods and spec.nodeName pods meet no scheduler): a new volume whose class does not fit leaves the pod waiting with not enough room on this node's data slabs for the <class> class …, the numbers and the five volumes that commit the most, and nothing is made. The check and the create are serialized. An engine with no slab API is not checked.
  • Alert: gauges kubelet_stormblock_data_bytes{kind} and kubelet_stormblock_data_used_percent; past --storage-alert-percent (85) written, one Warning SlabFilling Event on each of this node's stormblock PVs per crossing, and a log line. See service volume objects for the PV/PVC mirror, and for each stormblock PV's placement (drives, shelf/bay, RAID partners, health and rebuild, with Events on change; #60).

Virtual machine disks

With --runtime=stormpump the kubelet also runs the VirtualMachineInstances assigned to its node (pkg/kubelet/src/vm_manager.rs). Assigned is rustkube's scheduler's rule: status.nodeName (what the scheduler writes) when it is set, else spec.nodeName (a VMI placed by hand, which the scheduler leaves alone). The kubelet lists and watches both, and writes status.nodeName on a hand-placed VMI when it takes it (#85). Each volume of a VMI becomes a stormblock volume attached here:

VMI volume Disk Deleted with the VM
dataVolume / containerDisk <ns>.<vmi>-<disk>, a clone of the named golden made on the first start and reattached on every later one yes
cloudInitNoCloud <ns>.<vmi>-<disk>, a generated seed, made again on each start (the old one is replaced): NoCloud's files under CIDATA, or, on a VMI with storm.io/combustion, combustion's volume (label combustion, case kept, /combustion/script; stormblock#326 on the node). Which one is stormvm_cloudinit::medium (#245); an ignition/storm VM's seed disk is refused before anything is made yes
emptyDisk: {capacity} a blank volume <ns>.<vmi>-<disk>, reused if it already exists yes
persistentVolumeClaim: {claimName} the claim's volume, resolved exactly as for a pod (a bound claim uses its volume, an unbound stormblock claim is provisioned) no, it belongs to the claim

A stop only detaches (#75). A VirtualMachine restart is a new VMI, and it finds its disks by name: the root is what the guest wrote, and the golden is needed only the first time. A listing that fails is a failed start, never "make a new one".

"The VM" is the VirtualMachine. Each disk the machine makes carries a stormblock owner (owner {kind, namespace, name, uid}, stormblock#115). The owner is the VMI's VirtualMachine, or the VMI itself when there is none. The kubelet sweeps the engine's volumes when stormblock's volume watch or a VM/VMI watch reports a change, at most once a minute (events inside that are deferred, not dropped). A disk is deleted when its owner is gone for good: a 404, a new object under the same name (another uid), or a deletionTimestamp. Any other answer keeps it, and so does a disk in use or attached to a machine here.

Same name, new VM: a disk left by an earlier VM of the same name (another owner uid) is not booted. The start waits, with the reason on the VMI, until the sweep removes it.

Keeping disks: storm.io/retain-disks: "true" on the VMI or its VirtualMachine gives its disks no owner. The sweep never deletes them, and a VM made again under that name reattaches them. Disks of a machine adopted after a kubelet restart are given their owner then.

Stopping the VM never deletes a claim's disk; its PVC reclaim policy owns deletion.

A claim's disk waits, with the reason on the VMI, while the claim is unbound, belongs to another StorageClass, or is in use by a pod on this node. A pod mounts the filesystem and a VM writes the raw device, so the two must not share it. The reverse holds too: admission reserves a VMI's claims exclusively, so a Pod wanting a claim a VM here holds is not started. It waits Pending, its containers ContainerCreating with "claim ns/c is a disk of VirtualMachineInstance ns/vm on this node" and a FailedMount Event, and starts once the VM lets the claim go (#80).

Real-time pods (stormpump, #430)

A pod asks for real time with three things together:

  • runtimeClassName naming a RuntimeClass whose handler is realtime-soft or realtime-hard (stormcos#1477 ships them);
  • in each container that runs real time, stormpump.io/isolated-cores: <n>: whole physical cores from the node's isolated set, request equal to limit;
  • the pod annotation stormpump.io/realtime: "policy=fifo,priority=80,numa=0,same-cache=true,kind=p". priority (1 to 99) is required; policy is fifo (default) or rr; numa a NUMA node; same-cache true/l3 (one last-level cache) or l2; kind p or e (core kind on a hybrid part).

That container's stormpump spec gets Demand::Exclusive (the cores, in that shape; cpuset.mems follows them) and Sched::Fifo/RoundRobin at that priority, which the engine applies before execve. Everything is checked before the sandbox; a mistake is a wait with a RealtimeRefused Event naming the field, never a start that fails after the fork.

Real time is never inherited. A container without isolated cores runs SCHED_OTHER on the shared pool. A real-time handler with no container holding isolated cores is refused, because FIFO on shared cores can starve the node, the engine included. So is the annotation, or stormpump.io/isolated-cores, without a real-time handler. A restarted container resolves its RuntimeClass again, so it never comes back on the shared pool.

realtime-hard needs a PREEMPT_RT kernel (/sys/kernel/realtime is 1). Without one the pod is refused with the reason and a RealtimeRefused Event, and is never run as soft. realtime-soft runs on today's PREEMPT_DYNAMIC kernel.

The Node says what it can give: allocatable stormpump.io/isolated-cores is the number of whole cores in PID 1's --isolate set (SMT siblings once), so the scheduler's resource fit counts them. The labels are stormpump.io/realtime=hard|soft|none and kernel.stormpump.io/preempt=rt|dynamic|full|none (from the kernel's version and /sys/kernel/realtime), patched when they change. No taint is set (decided on #430, option A): the isolated cores are guarded by the resource and the engine, and a NoSchedule taint would stop a single-node cluster from scheduling its own pods. Unit-tested; not run on a node, which needs an isolated set (stormcos#1477).

RDMA verbs for a pod that asks

With the stormpump engine, a node whose kernel has RDMA verbs devices advertises rdma.storm.io/hca: <n> in capacity and allocatable (#348, stormcos#914). n is the number of uverbsN devices, and it is advertised only while rdma_cm is there too. The count is read from sysfs on each heartbeat (/sys/class/infiniband_verbs/uverbs*, /sys/class/misc/rdma_cm), with no device plugin process.

A container that puts rdma.storm.io/hca in its resources.limits (or requests) gets:

  • every node device under /dev/infiniband (uverbsN, rdma_cm), bound at the same path, as a raw block claim's device is. stormpump attaches no cgroup device filter, so they are usable as bound;
  • CAP_IPC_LOCK, so memory regions register past RLIMIT_MEMLOCK (the kernel pins against the rlimit unless the task has the capability). stormpump's spec has no rlimit yet (stormpump#230); when it does, the kubelet raises RLIMIT_MEMLOCK instead. A non-root container keeps the capability only if it is in its effective set.

A container that doesn't ask gets neither. A node whose devices are gone when the container is created refuses it (CreateContainerError naming what is missing, retried on the create back-off). rustkube's scheduler does not yet place by extended resources (rustkube#315), so such a pod can land on a node without devices and wait there.

Checked by medium's pod-rdma (skipped on a node that advertises none). A pod asking for one unit must see every uverbsN and rdma_cm as character devices, with CAP_IPC_LOCK effective. A pod that doesn't ask must see neither.

Virtual machine lifecycle

  • A VM-capable node says so (#65). With the stormpump engine (the only runtime that starts VMs), the kubelet checks for KVM on each heartbeat: the kernel's /sys/class/misc/kvm, or a /dev/kvm (its own or /hostroot's) that opens read-write. While it is there the Node carries devices.kubevirt.io/kvm: 1k in capacity and allocatable (KubeVirt's device plugin's resource) and the labels storm.io/kvm=true and kubevirt.io/schedulable=true. Without it the resource is gone, storm.io/kvm is removed and kubevirt.io/schedulable is false. A node on --runtime cri reports none of these. A test that requires: [kvm] checks kubectl get nodes -l storm.io/kvm=true.
  • A VMI being deleted stops its machine. While a machine runs, its VMI carries the finalizer storm.io/vm, so the deletion completes only once the machine is gone. The guest is asked first (#181): stormvm's Machine::shut_down(grace) sends system_powerdown (qemu) or the power button (cloud-hypervisor) and waits up to the VMI's terminationGracePeriodSeconds (default 30 s), in the background. The engine's stop (SIGTERM to the hypervisor, to qemu a power cut) follows only when the guest is still running, or when it said it powered off and the engine still sees the hypervisor 5 s later. Then the disks are detached (never deleted: see above). A VMI that sets terminationGracePeriodSeconds also has it on its machine's spec (shutdown_grace_secs, stormpump#56): on a node shutdown the engine waits that long for the guest before signalling the hypervisor (else 45 s, capped by the node's vm_shutdown_max_secs). On a node shutdown every guest is asked at once (#181, stormpump#144): the engine writes /run/stormpump/shutdown before it stops any workload; the kubelet watches for it and sends every running VM its power-down together (nothing forced, at most 3 s), so the guests run their graces while the engine waits. A SIGTERM with the marker does the same and exits; a SIGTERM without it is a restart, and the VMs keep running.
  • A VM outlives a kubelet restart (the engine supervises it), so the kubelet records each one where a restarted kubelet finds it: the machine's registration, /run/stormvm/<ns>/<name>/vm.json, with the engine's workload handle and its disks. Whenever the VMI set is read (the watch's LIST and each change), a registered machine the kubelet does not know is adopted when its VMI still wants it, and stopped when not.
  • A pod outlives a kubelet restart on stormpump too (#334). The engine keeps the kubelet's workloads and their handles while it is away, and hands it the exits it missed when it attaches again with the same token. The kubelet writes every sandbox and container, with its engine handles, to /var/lib/kubelet/stormpump-runtime.json after each change. A restarted kubelet reads it before it lists, sweeps or adopts anything; asks the engine about each running workload (one that ended meanwhile is recorded as exited, a handle the engine no longer knows as exit 255); then adopts the pods as on any runtime. The same container ids and restart counts are kept, and nothing is started again. The file carries the boot id: another boot's handles may name other workloads, so its records are never read. A container's terminal or stdin (tty/stdin: true) is a descriptor the kubelet holds (the pty master, or stdin's write end). At start a copy is deposited with the engine as a kept deposit, console/<container id> (#429, stormpump#260): the engine holds it while no kubelet does, so the terminal does not hang up, and a restarted kubelet takes it back (DEPOSIT_TAKE) when it adopts the container; kubectl attach then reaches the same terminal or stdin. It is withdrawn when the container is removed. On an engine older than stormpump#260 nothing is kept, and attach after a restart is refused saying so; logs and exec work. Unit-tested on a runtime rebuilt from the file and on the kept-deposit wire format; not yet run on a node.
  • A machine started by an older kubelet has no handle recorded. If its VMI is gone, it is stopped through its own control socket: shut_down (ACPI, within its grace), then quit.
  • A failed VMI list is skipped, not read as "no machines". Reading it that way stopped every VM on the node.
  • A failed start is retried, with backoff from 10 s doubling to 5 min.
    • The VMI stays Pending with reason FailedStart and a message giving the attempt, the wait and the error. Each attempt also has a Warning Event.
    • An engine refusal of the spawn names the op, the errno and the step in words, says when a helper (passt) exited before it was ready (ECHILD), and quotes the last lines hypervisor.log gained in that attempt (#335): stormpump refused Spawn: No child processes (os error 10) (waiting for a helper to be ready) [ECHILD: the helper exited before it was ready]; hypervisor.log: passt: ….
    • A new spec (metadata.generation) is tried at once.
    • A missing golden is not a failure: it waits, and is tried again on the waiting-start deadline (a quarter of the wait so far, 1–30 s). So does one still being imported (stormblock answers the clone 409 … not sealed): "waiting for golden (importing)", a Normal Waiting Event, no FailedStart backoff.
    • A start gives up, and the VMI goes Failed, only when its VirtualMachine's runStrategy is Once or Manual.
    • A failed start cleans up volumes created in that attempt; reused disks are kept.
  • Restarting a running: true VM whose instance ended is the VM controller's job (rustkube#104).
  • The pod network: a sandbox per VMI (#88, stormvm#16). A VMI with any NIC on networks: [{pod: {}}] gets what a pod sandbox gets (pkg/kubelet/src/vm_network.rs):
    • a network namespace from stormpump (sandbox_acquire, the pod profile) and a CNI ADD into it, as container vm-<uid> for the VMI's namespace, name and uid, before the deposit window;
    • its NICs realised there (stormvm_net::realise(p, Some(netns), …)): the bridge binding (pod: {} with bridge: {} or no binding named) moves the pod's address and MAC off the CNI's interface onto a bridge with the tap, so the guest holds the pod IP;
    • the hypervisor spawned in the sandbox (the engine joins a machine to it as it joins a container), so masquerade: {} NATs out of the pod;
    • a DHCP responder per bridged NIC (serve_dhcp), answering only the guest's MAC with the pod IP, gateway, the cluster DNS, the ClusterFirst search list and the VMI's hostname, held for the machine's life;
    • status.interfaces[] has the pod IP from the start and the binding stormvm chose (bridge, masquerade, passt, host-bridge); the agent and neighbour table do not replace a pod NIC's address. So the status does not say the guest took it: a bridge-binding NIC's tap is watched (#426), and a guest not seen with its pod IP (no lease, no traffic) 60 s after the start gets a Warning event PodAddressNotTaken on the VMI, naming the address, the MAC and the interface, once per machine.
    • passt: {} (pod:passt): stormvm's plan puts one passt per such NIC on the hypervisor's spec as a stormpump helper (/pallets/passt, stormcos#565), started before it and stopped with it, on the socket qemu's -netdev stream names (stormvm#7, #255). No passt on the node: the start fails at once at HelperReady. Hot-adding a passt NIC is refused by name (the engine starts helpers only at spawn).
    • The record (sandbox handle, netns, CNI identity, IP, leases) is written to /run/rustkube-node/vm-network/<uid>.json before the ADD. Teardown is CNI DEL and the sandbox release, retried until done: when the machine ends, when a start fails after the ADD, and at deletion. A restarted kubelet restarts DHCP for adopted machines and releases records with no machine.
    • No CNI configured yet (or --no-cni) keeps the VMI Pending with the reason, as for a pod; a failed ADD runs DEL and waits.
    • Its launcher Pod (owner's choice on #88; made by rustkube's VM controller, rustkube#203): a Pod labelled kubevirt.io: virt-launcher and kubevirt.io/created-by: <vmi uid>, owned by the VMI, on this node (during a migration the target node has its own; each node takes the one on it, #152). The VMI waits for it. The CNI ADD names that Pod (its namespace, name and uid), so Cilium labels the endpoint from it (the VMI's labels, so NetworkPolicy applies), and the kubelet writes its status: Running with podIP and Ready at start, Succeeded/Failed at the end, so Services select the VM. The pod manager never runs it. A terminating launcher Pod with no machine of its VMI here is confirmed deleted. Every VMI has its own sandbox and launcher Pod, so a namespace holds any number of VMs.
  • Multus networks on a VM (stormvm#85, #241; the Multus standard, owner on stormcos#249): networks: [{multus: {networkName: <nad>}}] is one more NIC per NetworkAttachmentDefinition, in the VMI's sandbox, as virt-launcher wires it.
    • Each NAD (name in the VMI's namespace, or namespace/name) is read before anything is made; one that is missing or has no spec.config keeps the VMI Pending (NetworkNotReady, naming it), as for a pod.
    • After the default network's ADD, each NAD's config is ADDed into the sandbox on its interface (net1, net2, … by order), as container vm-<uid>. multus: {networkName, default: true} replaces the cluster's network: its NAD is ADDed on eth0 instead, and its address is the VM's pod IP. Each is recorded (name, interface, config) before its ADD; DEL takes them last-first, then the default, from the record, also after a kubelet restart.
    • stormvm bridges the NAD's interface to the tap on vmnetN. When the NAD's IPAM gave the interface an address, a DHCP responder on that bridge (serve_dhcp_on) tells the guest it with no router, DNS or hostname, so the default route stays the pod network's; the lease records its bridge, so a restarted kubelet answers there again. With no IPAM, the guest asks the segment's own DHCP and its address is watched on the tap in the sandbox (snoop_tap_in).
    • status.interfaces[] has each multus NIC with binding multus and its address (not the pod IP), and the launcher Pod carries k8s.v1.cni.cncf.io/network-status: the default network first, then one entry per NAD (name its namespace/name, its interface, default: false).
  • A guest's address goes to status.interfaces[].ipAddress / ipAddresses from three sources, in this order:
    • The tap watcher: a NIC on one of the node's bridges (host, bridged:<name>, storm.io/bridge) is watched from before the spawn (stormvm-net snoop_tap). The guest's DHCP, DHCPv6 or SLAAC is seen on the tap and written to the VMI straight away, not on the next sync.
    • The QEMU guest agent, when the guest runs one.
    • The node's neighbour table (/proc/net/arp).
  • SSH keys: spec.accessCredentials.
    • noCloud / configDrive Secrets are read at start, and their keys go into the seed's meta-data public-keys, never user-data. That needs a cloudInitNoCloud volume. A missing Secret doesn't stop the machine.
    • qemuGuestAgent: {users} Secrets are applied through the guest agent once it answers. They're applied again whenever the Secret's keys change, with reset, so the Secret is the truth. A missing or empty Secret leaves the guest's keys alone rather than locking it out.
    • Status: the VMI carries AccessCredentialsSynchronized, with every reason when it is False: a missing Secret, no seed, or an agent not answering yet.
  • A running VMI's cpu, memory, interfaces and disks follow its spec (#246, #247, stormvm#24; pkg/kubelet/src/vm_hotplug.rs). A machine can grow only into the headroom it was started with: spec.domain.cpu.maxSockets and spec.domain.memory.maxGuest (stormvm renders maxcpus and a virtio-mem device; every qemu VM also gets four empty PCIe root ports for NICs).
    • When: once per VMI generation, and on first sight after a kubelet restart. The change is the spec against what the machine was last given, recorded beside its registration (/run/stormvm/<ns>/<name>/kubelet-hotplug.json: vCPUs, memory, NICs), not a reading of the machine. A machine started before this record existed takes the spec at its adoption as given.
    • vCPUs: cores × sockets × threads → set_vcpus(total). Only hot-added vCPUs are removed; the guest has 30 s to release one.
    • Memory: memory.guest → set_memory_within(bytes, floor): above the boot memory in 2 MiB blocks (virtio-mem); below it, through the balloon, down to the floor (#252, stormvm#19): the memory.min the machine booted with (its registration; KubeVirt's resources.requests.memory below memory.guest, which is what gave it a balloon). Below the floor, or below the boot memory with no balloon, is refused (HotplugSynchronized False with the verb's words). status.memory.guestCurrent is what the guest can use now (the balloon's share plus what is hot-added), guestRequested what was asked; while they differ the status is read again every 2 s, for at most 5 min (a balloon takes only what the guest gives back).
    • An interface added: a tap on a node bridge, or a secondary multus NIC in the VMI's sandbox (its NAD resolved, recorded, CNI ADD, a tap bridged to it, its network-status entry on the launcher Pod), then plugged in on a free root port, then watched and answered (DHCP) as a boot NIC is. qemu only for now. The pod network, and a NAD that replaces it, are given at start only; so is a NAD on a machine started with no sandbox: refused, to take effect at the next start. A NAD added before an existing one would renumber the sandbox interfaces (net1, …): refused, add it after them.
    • An interface removed: the guest releases the device (a boot NIC on q35 is not removable, and the verb says so), then its watcher, its DHCP, and a NAD's CNI DEL and network-status entry go.
    • Status: status.currentCPUTopology (cores and threads per socket as booted, sockets grown), status.memory (guestAtBoot, guestCurrent, guestRequested) and status.interfaces[]; Events VcpusChanged, MemoryChanged, InterfaceAdded, InterfaceRemoved.
    • A refusal (past the maxima, a device the guest kept, a network it can't have yet) is the condition HotplugSynchronized False with each verb's own words, and a Warning HotplugRefused Event, never a failed machine. It is tried again when the spec next changes.
    • A disk added (#247, stormvm#23): resolved and attached exactly as at start (a golden clone, an emptyDisk, a claim; owned as at start), then add_disk: virtio-blk on a free hot-plug port, or scsi-hd when the machine booted with a SCSI disk (cloud-hypervisor: vm.add-disk). A refused add gives the attach back (a CSI disk: that disk only) and deletes what was made for it. A disk waiting on its claim (unbound, used by a pod here) is tried again every 10 s. A cloud-init seed and a bus other than virtio or SCSI are start-only.
    • A disk removed: remove_disk (the guest releases it; a disk the VM booted with is on the root bus and refused), then its volume is detached (or its driver unpublishes it). The volume is kept: only a VM deleted releases its disks (#75). The machine's registration records its disks as they are now, so a restarted kubelet detaches what it has.
    • status.volumeStatus[]: each disk Ready (a hot-added one with its target and hotplugVolume), and each the machine could not be given, Pending with why. Events DiskAdded, DiskRemoved.
    • A VirtualMachine edit reaches the VMI through rustkube's VM controller (rustkube#269).
  • status.volumes[] (#373, stormvm#129): on the VMI, and on its VirtualMachine (written only when it changes), one entry per disk from stormvm_spec::volumes::status: name, role (root, data, cloud-init), volumeID (stormblock's id, once resolved; none for another driver's claim), golden, source and owned (whether the volume goes with the machine). A mirrored disk (#404) also has mirrored {volume, copies}: its stormstorage volume, and volumeID is the served volume this node attached. A hot-added disk is there on the next status write. This is the way from a machine to its volumes; each Volume's owner is the way back. A restore's volumes get their owner as soon as they are made: a restored disk its PVC (it is a claim and outlives the machine; the VM as owner would let the orphan sweep delete it under the claim), the restored memory state the VirtualMachine (none with storm.io/retain-disks).
  • Backups off the node (#380, stormvm#31, the owner's decision A): a VirtualMachineSnapshot with storm.io/backup-to: <store> is also a backup. Once it reads Succeeded on the node that took it, its group's disks are shipped to the store (changed extents only, against the last backup to the same store whose group is still on the node; the first backup to a store is a full copy, #458) by stormvm's Transfer, kept in status["storm.io/backup-transfer"] and stepped once per pass. status["storm.io/backup"] says phase (preparing, copying, sealing, done, waitingEngine, failed), store, point, incremental and the bytes. waitingEngine (an engine without stormblock#399/#400, or a store this node is not given) is asked again, never failed. Once done: the older backups' groups in the same store leave the node (storm.io/backupBaseReleased; each store's newest stays, as that store's next base), the store keeps the VM's storm.io/backup-keep newest points, and a scheduled snapshot whose point was pruned is deleted (storm.io/backupSettled when all of it went through).
    • Schedule: a VirtualMachine running here with storm.io/backup-every: 6h (1h at least; storm.io/backup-keep, storm.io/backup-to) gets <vm>-backup-<ms> snapshots, labelled storm.io/backup-of=<vm>, when one is due. A bad annotation is a BackupScheduleInvalid Event on the VM.
    • Restore from a store: a VirtualMachineRestore of a snapshot whose group has left the node copies its point back from the store (status["storm.io/restore-transfer"] on the restore), into <ns>.<vm>.<disk>.restored.<restore> volumes, bound and owned by claims and made the VM's disks as any restore. The memory is not on the store: such a VM starts cold.
    • Stores: --backup-store (configuration.md). The console's GET /api/v1/vms/{ns}/{name}/backups lists the node's snapshots and every store's points.
  • Snapshots: VirtualMachineSnapshot (snapshot.kubevirt.io/v1beta1).
    • Whose: the node whose stormblock holds the VM's volumes, the one it runs on (spec.source is a VirtualMachine or a VirtualMachineInstance). That node marks the object storm.io/snapshot-node (against its resourceVersion, so exactly one node takes it), sets InProgress, and takes it in the background.
    • How: stormvm freezes the guest (through its agent, when it has one), pauses it, takes one stormblock group snapshot of every volume, named <ns>.<vm>.<snapshot>, then unpauses and thaws. The agent is pinged first (5 s at most): a silent one (a blank disk, an image without qemu-guest-agent) is no agent, so the snapshot is crash-consistent with indication NoGuestAgent and no freeze or thaw is sent. A snapshot asked for straight after Running gives the hypervisor's control socket 5 s to be bound (#301, stormvm#28).
    • Status: Succeeded + readyToUse, or Failed with the error. virtualMachineSnapshotContentName is the stormblock group id, and it also carries sourceUID, indications and an Event on the object. failureDeadline (default 5 min) counts from creation.
    • Progress and detail (#187, stormvm#45): while it runs, status["storm.io/step"] follows the take as each step is entered (idling → freezing → cloning → thawing); the result carries the step it reached (on Failed, the one it failed in), status.snapshotVolumes.{includedVolumes,excludedVolumes} (the VM's disks taken and not; a disk on another driver's claim counts as taken once its VolumeSnapshot is cut) and status["storm.io/sizeBytes"] (stormblock's members summed; absent when unknown, as with VolumeSnapshots). Nothing is said about disks when no group was taken.
    • With memory (#251, stormvm#37; opt-in, qemu only): a VirtualMachineSnapshot annotated storm.io/memory: "true" also saves the guest's memory and device state, into a thin volume <ns>.<vm>.<snapshot>.state that joins the same group (the guest paused while its RAM is written). The kubelet opens the state volume's device itself (write-only, no truncate) and hands qemu the descriptor (fd:, stormvm c9cd494, #367): qemu's file: target truncates, and a ublk device cannot be. Its status then says storm.io/memory: true, storm.io/stateVolume and storm.io/memoryBytes. A VM with a disk on another driver's claim is refused (the state and that disk would not be of one instant).
    • Deleted with its content (#251): a snapshot this node takes carries the finalizer storm.io/snapshot; when it is deleted, its group snapshot and its state volume are deleted, then the finalizer, unless spec.deletionPolicy: Retain (KubeVirt's; the default is Delete). A refusal keeps the finalizer and is retried. Snapshots taken before this carry no finalizer and keep their content. A snapshot of a node that is gone keeps its finalizer: remove it by hand.
    • Restart: a kubelet restarted mid-take takes it again. stormblock answers a name it has seen with what it made then. A snapshot whose VM has left the node is Failed.
    • Needs the CRDs (stormcos#170): without them the list is a 404 and the kubelet does nothing.
    • A taken snapshot also records its disks (storm.io/snapshot-disks, {"<disk>": "<volume id>"}, from the registration, written with the claim).
    • A disk on another driver's claim (#157: a stormblock-csi claim, a RAID across servers) is taken KubeVirt's way in the same hold of the guest: one VolumeSnapshot per such disk, vmsnapshot-<snapshot uid>-volume-<disk>, of its claim, the driver's default class, owned by the VirtualMachineSnapshot, waited for until its driver has cut it (status.creationTime, at most 60 s, else the snapshot fails naming it). Which disks, and the claim each was (class, access modes, mode, size), is recorded at the claim (storm.io/snapshot-volumesnapshots). The driver must take snapshots (stormblock-csi#51 for stormblock-csi).
  • Restores: VirtualMachineRestore (#53; owner's option A, #109; pkg/kubelet/src/vm_restore.rs). Served by the node that took the snapshot when a disk to restore is in its stormblock (it holds the group); a restore whose disks were all taken as VolumeSnapshots (#157) is any node's, the first to mark it storm.io/restore-node (against its resourceVersion):
    • waits for the snapshot to be Succeeded and the VM stopped (no VMI), saying so in the Progressing condition;
    • for every disk in the snapshot's disk map except a cloud-init one (made again at every start), a new volume from that disk's member, <ns>.<vm>-<disk>-restore-<restore>; the old disks are left as they are;
    • for each, a bound PVC <vm>-<disk>-restore-<restore> (volumeMode: Block, label storm.io/restored-from) and its PV (class stormblock, pinned to this node, reclaim Delete). The VM's placement follows the PV;
    • the VirtualMachine's spec.template.spec.volumes[<disk>] becomes that persistentVolumeClaim;
    • status.complete with restores (disk, claim, snapshot) and a VirtualMachineRestoreComplete Event. An error (snapshot Failed, no disk map, the group gone) is written once, Ready False, with a Warning Event.
    • Every step is find-or-create, so an interrupted restore finishes on the next pass. A snapshot taken before the disk map was recorded cannot be restored: take a new one.
    • A disk taken as a VolumeSnapshot (#157) becomes a claim <vm>-<disk>-restore-<restore> with dataSource that VolumeSnapshot (it must be readyToUse; until then the restore waits), the recorded claim's class, access modes and mode, and its size or the snapshot's restoreSize when larger. No PV and no node: the driver provisions it from wherever its data is, so a stormblock-csi disk comes back from a surviving leg on another node (the owner's note on #109), and the VM goes where the driver serves it.
    • A disk of the built-in class is still made on the snapshot's node.
    • A memory snapshot (#251) also gets a volume from its state member, <ns>.<vm>-state-restore-<restore>, named on the VirtualMachine's template (storm.io/resume-state), and the restore says storm.io/memory: pending. The VMI made from it starts with qemu's -incoming file:<device>: the guest resumes where it was saved. Before anything is attached the kubelet checks what the annotation names (#449): the restore is in the VMI's namespace, restores the VMI's own VirtualMachine and still says pending; the volume is exactly that restore's state name; and the engine's record of it is owned by that VirtualMachine (same uid), or unowned only for a VM that keeps its disks. Anything else is a cold boot, with nothing attached, deleted, or written to any restore. The annotation is taken off the template at that start (a later VMI starts cold), and the VMI tries once. If qemu refuses the state (the VM's spec changed since the snapshot) or the guest does not run within 10 min, the machine is started again cold from the restored disks. An unpause that is refused is asked again within those 10 min (#449), and a machine given up on is stopped before the restore is told cold-boot: if the stop is refused, the resume is kept and tried again. The restore then says storm.io/memory: resumed or cold-boot with why (storm.io/memoryMessage), with a Resumed or ColdBoot Event on the VMI. The state volume is deleted either way.
  • A VM disk on another driver's claim (#157): a persistentVolumeClaim (or dataVolume) bound to another CSI driver's PV must be volumeMode: Block (a disk image on a filesystem claim is not supported, and is refused naming it). The driver stages and publishes it as a raw block for the VMI (VolumeCapability.block, after its VolumeAttachment when the driver attaches), at <root>/pods/vm-<vmi uid>/volumes/kubernetes.io~csi/<disk>/mount, and that path is the disk's device. It is unpublished (and unstaged when no one else here has it) when the machine stops or a start fails; records of a VMI with no machine here and not wanted here are swept. The pod sweep leaves vm- records alone.

Live migration

A VirtualMachineInstanceMigration (rustkube's controller and scheduler, rustkube#184; the CRD is stormcos#288) is carried out by the two kubelets through the VMI's status.migrationState, upstream KubeVirt's contract (#40):

  • The disks first. The source asks stormstorage to mirror each of the machine's volumes to a new volume on the target (POST /api/v1/nodes/{source}/volumes/{id}/migrate, stormstorage#44: a RAID leg on the destination, the owner's choice on #159) and records which migration is which disk's in the VMI's storm.io/migration-disks annotation. The target lists the VMI by status.migrationState.targetNode, waits until every copy is synced, attaches the copies (ublk), starts the machine with -incoming defer, arms its TLS listener and writes targetNodeAddress and targetDirectMigrationNodePorts. It never starts a migrating VMI cold.
  • Then the memory, over qemu's own TLS (stormvm#30): the source sends with the node's certificate, checking the target's against its node name, multifd with 4 channels, auto-converge and a 300 ms downtime limit on both ends; writes startTimestamp, then completed or failed (with failureReason) and endTimestamp. abortRequested before sending fails it at once, while sending cancels the transfer (abortStatus: Succeeded).
  • Post-copy, when allowed (#397, stormvm#132): the target resolves the migration's configuration as upstream does (the KubeVirt CR's spec.configuration.migrations, then the best-matching MigrationPolicy by its VMI and namespace selectors; neither is served on stormcos yet, so the default is upstream's: no post-copy, 150 s per GiB) and records it as migrationState.migrationConfiguration. Both ends set postcopy-ram from it. The source watches pre-copy's remaining. When it sets no new low for ten polls, or pre-copy has run past completionTimeoutPerGiB × the guest's GiB, it switches (migrate-start-postcopy), once: mode: PostCopy, Event PostCopy, Migrated says (post-copy). From then an abort is refused (AbortRefused): the guest runs on the target and what it lacks is only on the source. postcopy-paused (the link lost mid post-copy) fails the migration with that said plainly: the guest runs on neither node until the link is recovered.
  • After. The source's paused copy is stopped at once (never asked, never resumed, nothing reported), its disks detached; it is not started again while status.nodeName still names the source. The target adopts the machine (registration, identity, status, Events Migrated), owns its disks as the source did (#75), then cuts each disk over and completes it (stormstorage retires the source's volume). After a failure the source aborts each mirror (the target's copy deleted, its own untouched) and the target stops its receiver.

Configured by --stormstorage (and its token file) and --migration-tls-cert/-key/-ca (the node pair, issued for serverAuth and clientAuth); without them a migration from or to the node fails naming what is missing. A target listens from --migration-port (49152), one port per machine arriving at once. Not migrated yet, refused with the reason on the migration: cloud-hypervisor (no TLS migration), a disk the machine does not own (a claim, another driver's claim, a volume: it was handed: its PV names the source node), a VMI on the pod network, and a receiver whose kubelet restarted mid-migration (the migration fails; the guest stays on the source). Not run against two real nodes yet: stormstorage runs only on sno nodes until stormstorage#56/stormcos#354.

Direct kernel boot from the golden's own kernel

A VMI can skip the firmware and boot loader and start its golden's kernel straight away (#421, stormvm#111, vmcloud-image-operator#62). vmimages reads each golden's kernel, initramfs and command line out of it on every node that has the golden and publishes them on the CloudImage's status.boot; the VMI names them with three annotations:

storm.io/kernel: /data/vmimages/boot/fedora-44-x86_64/vmlinuz
storm.io/initrd: /data/vmimages/boot/fedora-44-x86_64/initrd
storm.io/cmdline: <status.boot.cmdline>

stormvm renders them as qemu's -kernel/-initrd/-append (cloud-hypervisor --kernel/--initramfs/--cmdline). No mount is made: the machine's stormpump spec runs in the node's mount view (Root::Inherit), where /data/vmimages is mounted, so the hypervisor opens the paths as named. Because it reads them in the node's view, the kubelet allows only files under --vm-kernel-dirs (default /data/vmimages/boot): each path must be absolute, with no .. component. Anything else (/data/stormcert/… as an initramfs would put the node's key in guest memory) fails the start, saying why. Every start of a machine is checked: a VMI's, a live migration's target, a restore's.

A VM disk mirrored across nodes from its golden

A golden's disk is normally a copy-on-write clone on the node's own engine, so it lives and dies with that node. A disk named in the VMI annotation storm.io/mirrored-disks ({"<disk>": <copies>}, at least 2; set it in a VirtualMachine's template so every VMI carries it) is instead a stormstorage volume, RAID1 across nodes, filled once from the golden (#404, stormstorage#113 option B', stormstorage#116):

metadata:
  annotations:
    storm.io/mirrored-disks: '{"root": 2}'
  1. The kubelet starting the machine asks stormstorage for <namespace>.<vm>-<disk>.mirrored once: POST /api/v1/volumes {name, size_bytes, raid: "mirror", replicas, from_golden, prefer_node: <this node>, owner}. size_bytes is the golden's size on this node, or the disk's size when larger. A 409 (no placed node holds the golden) waits.
  2. Until stormstorage's seed.state is done the machine stays Pending, saying how many bytes are left; a failed copy is retried by stormstorage after its cooldown, and the condition says why.
  3. Once done it is served to this node's host NQN (POST …/export/hosts; /etc/nvme/hostnqn, else nqn.2026-09.lo.storm:host-<node>, stormblock's own fallback), and this node's stormblock attaches the served volume (export.local_id) as ublk: a peer's volume over NVMe/TCP when the head is another node (stormblock#328). The guest boots from it.

status.volumes[] names it (mirrored {volume, copies}). The next start, here or on another node, finds the volume by name and boots from it as it is. A stop withdraws the node's host. The volume is the VirtualMachine's (#75): once the VM is gone and no host is served, the kubelet's sweep deletes it through stormstorage. The engine's sweep never deletes its legs. It needs --stormstorage. A request naming a disk that is not a golden's, or on a node with no stormstorage, fails the start saying why. A mirrored disk is not the machine's own engine volume, so a live migration or a disk move refuses it, as it refuses a claim. A disk added to a running machine is mirrored the same way.

A running disk moved off the node

A disk can move to another node's storage while its VM keeps running where it is (#302, stormvm#29). Ask for it with the VMI annotation storm.io/move-disks, a JSON object naming each disk's node:

kubectl annotate vmi web-1 'storm.io/move-disks={"data":"node-b"}'

The kubelet running the machine:

  1. asks stormstorage to mirror the disk's volume to a new volume on that node (POST /api/v1/nodes/{node}/volumes/{id}/migrate, stormstorage#44) and writes its record, storm.io/disk-moves (per disk: to, node, from, migration, state, bytesTotal, bytesRemaining, volume, message, and resume while the guest is not known to run again). The record shows the progress, and a restarted kubelet resumes from it. A record that could not be written is kept by the kubelet and written on the next pass (#449). Before starting, the kubelet asks stormstorage for a copy of the volume already running (GET /api/v1/migrations): one to the same node is carried, a failed one is aborted first, and one to another node refuses the move.
  2. Once the copy is synced, it pauses the guest, cuts the migration over, attaches the copy here through the node's stormblock (a peer's volume over NVMe/TCP, served as ublk, stormblock#328), puts the disk on the copy's device (stormvm's switch_disk: the guest's device, serial and slot don't change) and runs the guest again. The guest is paused for one attach and two QMP calls (paused_ms in the log).
  3. Once the guest is seen running (its machine's status, not only the unpause's answer, #449), it detaches the old volume here and completes the migration, which retires the old volume. Until the guest runs the move stays switched with resume: true and why in message, and every pass (and a restarted kubelet) tries to run it again. The machine's registration and the record name the copy, so the next start of the VMI attaches it.

The states are copying → switching → switched → moved.

Failures:

  • A failure before the switch (pause, cutover, attach) runs the guest again on its own disk and aborts the copy: failed.
  • A switch that answers an error is unknown. The answer may have been lost after the switch went through, so nothing is deleted or retried, and a person decides.

Taking a request back:

  • A copy no longer asked for (or asked elsewhere) is aborted while it is still copying.
  • A failed record is dropped once its disk is no longer asked for, and asking for another node starts again.
  • Asking for this node moves a disk back.

What can be moved: only disks the machine owns (a golden's clone, an emptyDisk). These are refused, with the reason on the record:

  • a claim (its driver moves it) and a volume: (somebody else's);
  • the cloud-init seed (it is made again at every start);
  • cloud-hypervisor machines;
  • a machine being live-migrated.

A machine with a disk on another node is not live-migrated yet. --stormstorage is required.

Not yet:

  • The kubelet sets the copy's owner through its own engine, and stormblock does not yet relay PUT …/owner to the peer (stormblock#519). Until then, deleting the VM does not delete a disk that moved off the node.
  • Not run on a two-node fabric yet.

A golden made from a running VM

A VirtualMachineGolden (storm.io/v1alpha1, short name vmg) asks for a golden made from a running VMI's root disk (#344, vmcloud-image-operator#50, stormvm#17). vmimages writes it (spec.vm, spec.golden, spec.image); the kubelet of the node the VM runs on does the work, because it owns the machine, its disks and its guest agent. The steps are stormvm's (stormvm_node::golden):

  1. The root disk alone is snapshotted (frozen and paused for an instant). The source keeps running and is otherwise untouched. status.phase: Snapshotting.
  2. A volume is made from the snapshot under spec.golden, and booted once as a sealer: the source's machine with the copy as its only disk, no NIC, no seed, the guest agent on. Sealing, with status.volumeId.
  3. The sealer runs stormvm's de-identify script (cloud-init state, machine-id, SSH host keys, hostname, logs) and must print its end marker; it powers off and the copy is detached. It runs from PID 1, as stormvm-seal.service, which the sealer's SMBIOS type 11 credentials install on a guest with systemd ≥ 256; the kubelet reads its result from the sealer's serial log (STORMVM-SEAL <copy id> … markers). Only when the unit says nothing for 90 s after the agent answers (an older systemd, or none) does the guest agent run it, because qemu-ga's guest-exec is denied every write on an SELinux-enforcing guest (stormvm#135, #399). That failure names the agent's SELinux domain and mode.
  4. The copy is sealed and the group snapshot deleted. Sealed, with node, volumeId, volume, sha256 (the engine's digest), arch, firmware, provenance (vm:<ns>/<vm>@<time>) and sealedAt.

Any failure is Failed with the reason, and the sealer, the copy and the group are removed. A guest with neither its agent nor stormvm-seal.service (systemd < 256) is Failed: a golden that was not de-identified is worse than none. A guest with the unit but no agent seals by the unit. A request runs once: Sealed and Failed are left alone, and one this node was running when its kubelet restarted is Failed and cleaned up (ask again). A volume already named spec.golden is refused before anything is made (stormblock's create by name would answer it, and the sealer would rewrite it).

The golden gets no owner: it outlives its VM (the registry adopts it, and other machines boot it), and a VM-owned volume is deleted by the orphan sweep once its VM is gone (#75). Having the node's registry adopt it as media is vmimages' step. The sealer is registered as vmgolden-<request uid>, which the VM manager's orphan and adoption passes leave to its request.

Limits: the engine calls go through stormvm's client, so an https:// engine URL needs #318 (as snapshots do). On one node, volume_from_snapshot relies on stormvm 893b2e8 or later (#345: no slave replicas on a restore); the kubelet pins a302b3e (#352, #355, #367, #373, #380). The kubelet's identity (system:nodes) is bound to cluster-admin by rustkube's bootstrap, so no RBAC is added; a tightened node role needs get/list/watch on virtualmachinegoldens and patch on virtualmachinegoldens/status.

A stopped VM's disks moved to another node

A stopped VirtualMachine (no VMI) can have its disks moved to another node, so its next start is there (#339, stormcos#806 test 3). Ask on the VM:

kubectl annotate vm web-1 storm.io/move-to=node-b

The kubelet whose stormblock holds the disks (by their record, else a volume <ns>.<vm>-<disk> owned by the VM) moves each disk the VM owns (a golden's clone, an emptyDisk) with stormstorage's migrate, as above but with no guest to pause: copying → (in sync, nothing attached) cutover → switched → complete → moved. The record is the same storm.io/disk-moves, each entry stopped: true, written on the VM's spec.template.metadata.annotations, so rustkube's VM controller copies it onto the next VMI and that start attaches the moved volumes. A one-line account for a person is storm.io/move-status on the VM (moving: root copying to node-b (40%), moved: …, failed: …, refused: …), with Events on the VM.

Once every disk is on node-b, the kubelet sets the template's nodeSelector kubernetes.io/hostname: node-b (replacing any hostname there: the request is to run there), so rustkube's scheduler places the next VMI on node-b. That start sets the VM as the moved volumes' owner in node-b's engine (#75), so deleting the VM deletes them.

Refused or stopped:

  • A VMI exists (the VM is running): refused, said on the VM. Its disks move by storm.io/move-disks (above) or with it by a live migration (#40).
  • A disk still attached (a stop not finished): waited for.
  • A VMI that appears during the copy: the copy is aborted, the disk stays.
  • Any disk's copy failing: the disks still copying are aborted, so the VM stays on its node. A start waits while a move is in flight, and while the disks are on more than one node's storage (one moved before another failed): the status says where each is. Take the request off and put it back to try the failed ones again.

Not moved here: a claim (its own move, #338), a volume:, the seed (made again at every start). Not run on two nodes yet (stormcentral#360's pvetest pair, stormcos#806 test 3); a migrate of a detached volume is confirmed on stormstorage's side by stormstorage#106.

A built-in claim moved to another node

A bound claim of the built-in class moves to another node's storage under the same PVC (#338, stormcos#806 tests 1 and 5). stormcluster's drain asks for it (stormcluster#104), and so can a person:

kubectl annotate pvc -n db data storm.io/move-to=node-b [storm.io/move-set=<RAID set on node-b>]

The kubelet whose storage holds the claim (the PV's node) drives it, and reports on the PVC:

  • storm.io/move-state: copying (stormstorage mirrors the volume to a new one on node-b, onto the RAID set if one is named; the pod keeps running and every write lands on both), then synced. At synced the drain evicts.
  • Once no pod on this node runs on the claim (a replacement Pending here does not count), and none is starting on it: cutting-over. The kubelet detaches the volume here, cuts the migration over, retires the source, and points the PV's nodeAffinity (and storm.io/node) at node-b. Then the state is complete. A claim no pod uses is cut over as soon as it is in sync.
  • storm.io/move-progress: how much is copied, or what the cutover waits for.
  • failed / aborted / refused, with storm.io/move-reason, and Events on the PVC.

stormcluster reads "cut over" from the PV. The PV keeps its volumeHandle: the copy on node-b is named like the source (pvc-<ns>-<claim>). The scheduler then places the pod on node-b through the PV's affinity, and node-b's kubelet attaches its own volume as for any claim. rustkube's apiserver takes the PV's new affinity. Upstream only allows that with MutablePVNodeAffinity (KEP-5381).

Refused: a ReadWriteMany/ReadOnlyMany claim; a claim pods on another node use; a node service's own data volume; a target that does not exist or isn't Ready; a target whose CSIStorageCapacity has no room for it; a node with no --stormstorage.

Given up (the claim stays where it was):

  • A failed copy.
  • A refused cutover (the copy is aborted), when stormstorage still reports the copy in sync after the refusal. A cutover call that errors without an answer (a timeout, a 5xx) is not taken as a refusal. The kubelet reads the migration again: if it is cut over or completed, the move goes on (source retired, PV pointed at the target), and if it is still in sync, the next pass asks again (#428).
  • The request taken off, or changed to another node, before the cutover (aborted).

A failed or refused move stays as it is until the request is made again (stormcluster clears the state when it asks).

A pod on the old node waits on the claim while it is cut over, and once the PV names another node: it is never given a fresh volume beside the moved one. A pod already bound to the old node stays Pending there, saying where the claim went. A drain cordons the node first, so the replacement goes to node-b.

Not run on two nodes yet (stormcos#806 tests 1 and 5, stormcos_qa#84's move/claim-node).

Tests on a node

test/ is the test container, per stormcentral's docs/test-standard.md. It is a standalone crate (its own workspace and Cargo.lock). test/build.sh builds its static binary on the build box, and test/Containerfile copies it into a scratch image. The image is started as /test <suite> and run by stormcentral as a Job (test/rustkube-node-test.yaml):

stormcentral test run rustkube-node short --tag <machine> --url http://stormcentral.g8.lo

Every pod a suite makes is pinned to the test node (spec.nodeName): the kubelet is under test, not the scheduler.

  • short (< 2 min, the release gate, #61): needs nothing a machine may lack.

    • node-ready: the Node is Ready, its heartbeat is under 120 s old, its kubelet reports a version, and no pressure condition is True.
    • pod-runs: a pod runs to Succeeded with exit code 0 and a pod IP, and its log reads back through the apiserver.
    • pod-exit-code: a container exiting 3 leaves its pod Failed with exit code 3.
    • pod-delete: a running pod, deleted, is gone within 30 s.
  • medium (< 30 min): pod features and failure paths (#61), which run with or without the storage class:

    • pod-restart-on-failure: OnFailure, failing once: Succeeded with restartCount 1, and log?previous=true is the failed run.
    • pod-init-first: an init container's file (emptyDir) is there for the main one.
    • pod-config: a ConfigMap volume, configMapKeyRef and fieldRef env.
    • pod-missing-image: an image no registry has waits as ErrImagePull or ImagePullBackOff and never runs.
    • pod-carried-image (#332): nextnfs --help from a golden the release lists in /etc/stormblock/carried and doesn't mount at boot Succeeds on its own root (storm.io/instance.main is the engine volume id of its ctr-… clone, not the listed volume). Skipped, saying why, on a release that doesn't show that.
    • pod-image-on-no-list (#332): a bare image on neither list waits with the registry's "not here": its 404, or on a node with peers the cluster demand's "no peer has it" (#79).
    • pod-logs-follow-ends (#416): log?follow=true ends with the container's run: a Succeeded pod's followed log is sent whole and ends within 20 s; a running pod (sleep 8) is followed from the start and its stream ends within 20 s of its exit.
    • pod-multi-* (#374): one pod, medium-multi, with an init container, a sidecar (restartPolicy: Always) and app containers a and b. They share an emptyDir, a 1Mi claim (an emptyDir without the class), the network and IPC; each runs member, which reaches its peers on 127.0.0.1 before it listens. pod-multi-ready: Running, every condition True, init Completed, the sidecar started, a and b ready with their own resources. pod-multi-localhost: b reached a and the sidecar on 127.0.0.1. pod-multi-logs: each container's log?container= is its own. pod-multi-exec: exec -c b (the pods/exec WebSocket) finds init's file; exec -c a finds its postStart hook's file. pod-multi-ipc: b reads a's /dev/shm. pod-multi-restart: a crashes once and restarts alone (lastState exit 1, its --previous log); b and the sidecar keep their ids. pod-multi-stop-order (with the class): after the delete, a reader pod on the claim finds both preStop hooks' files, and the sidecar's SIGTERM after a's and b's.

    And claims of the built-in stormblock class (#64):

    • It makes a claim at every filesystem size class (1Mi … 16Ti) and at arbitrary sizes: 1 byte, 1Mi+1, 17Mi, 1500M, 3.5Gi and 600Gi, and raw block claims of 1Mi, 20Ti and 1Pi (volumeDevices; the device must be exactly its class), plus a 1Mi one with its device at /block/xvda, outside /dev. The cases run three at a time, largest first. pvc-size-block-1mi needs stormpump#222's fix (12.64 on). A class above the node's maximumVolumeSize is checked as a refusal.
    • For each one, a pod writes and reads back 64 KiB and checks that df is within the class the request rounds to. The test then checks that the claim is Bound with that class as its status capacity, and deletes the pod and the claim. The PV must be reclaimed.
    • A 2Pi claim, placed with spec.nodeName so the kubelet's own check is what answers, must be refused with the reason, and never bound; a 20Ti filesystem claim (64Ti class, no ext4 blank yet) must wait naming volumeMode: Block.
    • Every case has RUSTKUBE_NODE_TEST_MINT_BUDGET (default 1200 s), because a class may be minted on first use.
    • Overcommit (#62): a Block claim one class above the test node's published maximumVolumeSize, its pod pinned to the node, must wait with "not enough room" (or the scheduler's capacity reason) and never bind; skip when the node can still take the largest class.
    • The node's own volumes (#59): every claim mirrored for the test node is <namespace>/<volume>-<node> (its service's namespace, #418), Bound to storm-<volume>-<node>, whose claimRef names it by uid, with the same kind and component labels; one claim is deleted and must come back with its PV naming the new uid.
  • long (the night window, on a pve VM): waves of pods, each 80% of the node's free pod slots (RUSTKUBE_NODE_TEST_WAVE_MAX, default 500), every fourth with a 16Mi built-in claim written by an init container. The pods go in steps of ten, and the ramp stops adding them when the node's MemAvailable (/proc/meminfo, read by the runner on the node) is under 20% of MemTotal, at least 1 GiB (RUSTKUBE_NODE_TEST_MEM_FLOOR_PCT); later waves take the first wave's size. Per wave (wave-<n>, with pods, p50_ms, p95_ms, drain_ms, left, mem_before_mib, mem_low_mib, mem_stopped, api_slowest_ms, api_errors as fields): each pod's start (create → seen Running, 1 s resolution, or the pod's own startedAt − creationTimestamp + 1 s when that is less, so a hung API call of the runner's does not read as a slow start), a 30 s hold and a log read, then the drain. A wave fails on anything left after its drain (pods, claims, PVs) or a p95 start over twice the first wave's plus 2 s, and then names its three slowest pods; an API call over 5 s or a failed one is named in the wave's line. Waves repeat until the suite's time is nearly out (RUSTKUBE_NODE_TEST_WAVES caps them for a hand run). VM waves are stormcos_qa's vm-waves.

  • csi (< 15 min, declared in test/requires.toml, run on request, #52): the kubelet's CSI node side against a real driver process, this image's own csi-driver mode (no third-party image). The suite makes a CSIDriver named for the run (attachRequired: false), the driver's pod (privileged, /var/lib/kubelet as a Bidirectional hostPath), and a Retain PV of that driver pre-bound to a claim. The driver serves Identity and Node (no staging) and registers itself on plugins_registry. NodePublish bind-mounts the volume's own directory at the target, so data outlives a publish. Cases:

    • csi-registered: CSINode lists the driver with the node's name as nodeID.
    • csi-claim-bound: the claim is Bound to the PV.
    • csi-publish: a pod writes a file on the claim; the driver logged its NodePublishVolume (the mount reached the pod through propagation, or the kubelet's mountinfo check would have held the pod).
    • csi-unpublish: the writer deleted, the driver logs its NodeUnpublishVolume, and a new pod reads the file back.
    • csi-kubelet-restart: a pod holds the volume while a privileged hostPID pod (restart-kubelet) SIGTERMs the kubelet and waits for the new one. The holder keeps its container, the driver is registered again, a new pod reads the file, and the holder's delete is unpublished by the restarted kubelet. Skipped until a test machine runs a kubelet that adopts its pods (#334): on an older one it loops the kubelet. Turned on (KUBELET_RESTART_ADOPTS) once one does.
    • csi-deregistered: the driver pod deleted, CSINode no longer lists it.
  • multus (< 10 min, declared in test/requires.toml, run on request, #233): a pod's extra networks by the Multus standard, with the standard CNI plugins in cni-bin (stormcos#495). Three NADs in the run's namespace (host-local IPAM, stores named for the run; bridges rknt0/rknt1 with no address on the host, reused by later runs):

    • multus-two-nics: a bridge NAD and a macvlan NAD (the default-route interface) give the pod net1 and net2, each with an IPv4 address seen from inside the pod, and the same in k8s.v1.cni.cncf.io/network-status (the default first, then <ns>/<nad> per network).
    • multus-missing-nad: a pod naming a NAD that does not exist never runs; a FailedCreatePodSandBox Event names it.
    • multus-release: a NAD whose range holds one address, used by two pods in turn: the second gets it only if the first's delete DELed its attachment.
  • realtime (< 5 min, declared in test/requires.toml, run on request, #430):

    • realtime-node: the Node's stormpump.io/realtime and kernel.stormpump.io/preempt labels agree with its allocatable stormpump.io/isolated-cores.
    • realtime-soft-fifo: a realtime-soft pod with two isolated cores and policy=fifo,priority=80 reports, from inside, what the kernel gives it (rt-view): SCHED_FIFO 80, two whole cores, memory on their NUMA nodes.
    • realtime-hard-refused: on a kernel without PREEMPT_RT, a realtime-hard pod is not run and its RealtimeRefused Event names PREEMPT_RT. The pod cases skip, saying why, without an isolated set or the RuntimeClasses (stormcos#1477).
  • metadata (< 5 min, declared in test/requires.toml with host_network, run on request, #342): a host-network pod asks its node's kubelet (https://127.0.0.1:10250/vmInstance/<address>) for its own instance metadata, with its own bound ServiceAccount token as Authorization and as X-Storm-Workload-Token (what stormimds forwards, #122):

    • metadata-own-token-loopback, metadata-own-token-node-ip: at 127.0.0.1 and at the node's InternalIP, 200 with storm.io/kind: Pod and the pod's own namespace, name and uid. A refusal reports the kubelet's error.
    • metadata-no-workload-token: the node's address with no workload token is 404.

The same image is the workload pods' program (/test sized <path> <seed> <bytes> <lo> <hi>, /test echo …, sleep, exit, fail-once, write-file, expect-file, expect-env, expect-nics for the multus suite, vm-instance for the metadata suite, rdma-view for medium's pod-rdma, and csi-driver, restart-kubelet for the csi suite), so a run pulls nothing else. The crate builds the CSI and plugin-registration protos the kubelet vendors, so it needs protoc too. Check it builds with sc-build 'cd test && cargo test --locked && cargo build --release --locked'.

Required test inputs are listed in configuration. The image the workload pods run is the Job's own (#97), and STORM_NODE (an address) is resolved to its Node. Live: short passed on C2NR0Q2 (#97); medium on pvetest2 and C2NR0Q2 (12.64); csi on pvetest1 (#52). Long runs the whole night window (ccfea13ac4, pvetest1, 12.81: 632 pass, 2 fail); its failures are a ~30 s kubelet start stall, #370.

Relationship to rustkube

  • Control plane (kube-apiserver, controller-manager, scheduler, fastetcd) lives in rustkube.
  • Cluster DNS is a platform service. Pod DNS configuration is built in pod_manager.rs; this repository does not run a DNS server.
  • Shared types come from rustkube's apimachinery crate, as a git dependency pinned to a commit (Cargo.toml, [workspace.dependencies]):
    apimachinery = { git = "https://github.com/glennswest/rustkube", rev = "<commit>" }
    This checkout builds on its own. Moving to a newer rustkube means changing rev and running cargo update -p apimachinery.

Build and ship

From a clean checkout, commit and push first, then:

sc-build 'cargo build --locked && cargo test --locked'

The build service fetches the pushed commit into an isolated scratch build on dev and deletes it afterwards. Do not build on the session VM or create a persistent checkout on dev.

A stormcos release consumes a stage golden, containing stormd, its config and the binaries. After completed release work passes validation, request it through stormcentral component stage rustkube-node --url http://stormcentral.g8.lo. Do not use component build: it produces the bin-only artifact that cannot start this service. The repository's own golden builder (scripts/build-golden.sh) was removed (#51). See BUILD.md for the complete workflow.

License

Apache-2.0

About

Node level of rustkube (Rust Kubernetes): kubelet, kube-proxy, cni

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages