A Kubernetes operator, written in Rust with kube-rs, that manages vLLM inference workloads and treats cold start as a first-class signal — first for single-service lifecycle, now as the basis for GPU fleet orchestration under spot preemption, validated with measured data on real GPUs.
Kubernetes decides a pod is ready when its process is up. For an LLM inference server that is the wrong moment: the process is alive, but it still has to load weights and warm up before it can serve a token. This operator models that gap explicitly, and uses it to make placement and rescheduling decisions: a warm node with the model in cache is a fundamentally better reschedule target than a cold one, and the difference is measured in minutes of service degradation.
The operator is the operational half of a pair of tools:
- vllm-coldstart-probe — an eBPF profiler that traces vLLM's syscalls and libcuda calls during cold start (it does not see the weight reads).
- vllm-coldstart-operator (this repo) — acts on that knowledge inside a cluster.
Measured results: preemption without cascade
The headline claim — a spot preemption on one node does not cascade to the rest of the fleet, and recovery is bounded — was validated on a real 3-node GPU fleet (3x NVIDIA A10, Lambda, k3s v1.36.2+k3s1, vLLM v0.23.0 digest-pinned, Qwen2.5-7B-Instruct) under closed-loop load, 3 repetitions:
| Metric | rep1 | rep2 | rep3 |
|---|---|---|---|
| Errors on unaffected service (all windows) | 0 | 0 | 0 |
| Replacement pod Ready (warm spare, model cached) | 57s | 57s | 57s |
| Old pod killed (after replacement Ready) | T+58s | T+59s | T+59s |
| Max service gap on moved service | 2.3s | 2.27s | 2.28s |
| Failed requests on moved service (per event) | 4 | 4 | 6 |
The recovery sequence is make-before-break: on a preemption notice the operator surges a replacement onto the warmest surviving node, waits for it to become Ready (weights load from a local modelCacheHostPath cache, not the HF CDN — that is the difference between 57s and several minutes), and only then drains the preempted node. Decision latency from notice to reschedule action is sub-2s.
Full evidence — per-request JSONL, operator logs, Kubernetes events, resource snapshots, provenance (driver, digests, model snapshot hash) — is committed under hack/gpu-session/runs/2026-07-04/, including per-rep timeline.png plots.
Disclosed boundary: the preemption notice was injected via a NodeState status patch; detecting the cloud provider's real notice (e.g. the metadata endpoint) is out of scope for this validation. What is measured is everything downstream of the notice: decision, surge, drain, and service continuity.
Method note: the entire preemption mechanic was first validated on a zero-cost kind rehearsal harness (hack/rehearsal/); the GPU session then reproduced it on real hardware in ~1.5h for $5.58.
Measured results: autoscaling that counts warming replicas
A replica that is warming is capacity that has been paid for and has not arrived yet. An autoscaler that reads only ready replicas cannot see it, so it re-requests the same capacity on every tick for the whole warm-up.
FleetService publishes status.warmingReplicas alongside status.replicas
and exposes the scale subresource, so the consumer of that number does the
subtracting (ADR-0009). To
find out whether publishing it changes anything, two arms of one instrumented
consumer were run against the same workload: one counting ready replicas
only, one counting ready plus warming.
Four pairs on kind, 3 workers, a 60 s synthetic warm-up, demand stepping x4 at t=120 s, each pair replaying one frozen trace whose hash was checked identical in both arms, order alternated NW/WN (evidence, design and results):
| ready-only | ready + warming | |
|---|---|---|
| peak replicas | 27, 28, 28, 28 | 4, 4, 4, 4 |
| replica-seconds held | 12,364 | 2,113 |
| requests served per replica-second | 0.330 | 1.931 |
| requests served / failed | 4080 / 0 | 4080 / 0 |
Peak allocation falls 85.6% (bootstrap 95% CI [85.3%, 85.7%]) and held allocation falls 5.85x, with 10,252 replica-seconds per run that no request used. The replica-second ratio is the smaller figure and the one to quote: peak flatters the result, since the ready-only arm also spends the pre-step part of each run at low counts. Both arms served every request with no failures, so the excess buys nothing.
Two limits stated with the number. The confidence interval is narrow because the warming-aware arm sits at exactly 4 in every rep, so it describes the reproducibility of the mechanism more than the uncertainty of the effect. And the effect is quoted at the consumer's 5 s tick: the ready-only peak is a function of how many ticks fit inside a warm-up window, falling to 22, 16 and 13 at 10, 15 and 20 s ticks. The mechanism is the claim; the percentage is the claim at one tick and one warm-up time.
The consumer is instrumentation, not a product — not an HPA, not a KEDA scaler, and its capacity model is a constant. What is measured is the value of the information the operator publishes, not the quality of any particular autoscaler.
Measured results: efficiency-aware placement, a negative result
The per-node reporter publishes window-based tokens/joule and KV-cache hit-rate into NodeState.status, reimplementing the NVML energy read that inferscope's ADR-010 validated and scraping the vLLM series that inferscope's ADR-011 names; placement ranks them as strict lexicographic tie-breakers inside warmth classes (EfficiencyAware strategy). Design accepted in ADR-0007. Phase A done: EfficiencyAware comparator as a pure function with property-tested warmth dominance and fail-open absence semantics, status fields and CRDs in place. Phase B done: per-node reporter (same image, DaemonSet entrypoint, disjoint-ownership status merge-patches), strategy threaded through both natural decision points (initial planning and post-preemption replacement), opt-in Helm wiring with least-privilege RBAC. Falsification level 2 passed 5/5 on kind (hack/rehearsal/adr0007-run.sh): EA discriminates on kvCacheHitRate at equal warmth on both decision paths, and degrades to warmth-first when signals are absent. The first in-cluster run also surfaced (and fixed) a real schema/design mismatch — required status fields are incompatible with multi-writer merge-patch ownership. Phase B extended with the real signal source: VllmScrape (vLLM prefix-cache counters, inferscope ADR-011 schema) and an NVML sampler behind a build-feature plus runtime double gate, joined cross-source into tokensPerJoule on the same reporting round. Level-3 mechanism validated on 3x A10 (Lambda, k3s, one vLLM per node, evidence): NVML populates NodeState.status in vivo on all three nodes and the KV-cache scrape on the one that received traffic (the replay drove a single endpoint), EfficiencyAware and WarmthFirst diverge deterministically at both decision points, 8/8 reps clean with the operator log free of anything but two named benign classes. The primary hypothesis was open until phase C closed it, and the answer is negative. The level-3 run could not test it — the replay drove one fixed endpoint by design and nothing routed traffic to the service just placed, so both arms measured the same loaded node and the near-zero delta was determined before any GPU minute was spent (recorded as a post-run amendment in that experiment design). Phase C built the missing path — placements publish what the planner ranked on, observations carry when they were measured, and a dispatcher sends the workload to the placed replica — then measured 8 reps on 3x A10: EfficiencyAware 10.384 tokens/joule on the placed node against WarmthFirst 10.175, +2.05%, 95% CI [-2.5%, +6.6%], below the +3% threshold fixed before the run. A negative result about EA under this workload, and one this design was entitled to draw: the strategies diverged deterministically, with EA choosing the better-tokens/joule node in 4 of 4 reps across both physical machines while WarmthFirst took the same node every time by list order. Two findings travel with it — the power cap makes a node more efficient per token rather than less, the opposite of what the design assumed, so the available margin was ~6% and a +3% threshold against it is a demanding test; and the pre-flight caught the reporter publishing 0.0 tokens/joule for an idle GPU, which would have handed both arms identical inputs and reproduced the level-3 null from the instrument.
What it does
The operator manages two custom resources.
VllmService — cold-start-aware single service
apiVersion: inference.michelecampi.dev/v1alpha1
kind: VllmService
metadata:
name: qwen-7b
spec:
model: "Qwen/Qwen2.5-7B-Instruct"
replicas: 1
warmupStrategy: Eager # Eager | Graph
For each VllmService, the controller reconciles an owned Deployment via idempotent server-side apply (owner references make deletion garbage-collect everything), maps warmupStrategy to real vLLM configuration (Eager = faster cold start for scale-to-zero; Graph = CUDA graphs on, faster per-token decode but not always more throughput, see BENCHMARKS — the operational lever behind the probe's finding that CUDA graphs make cold start ~3x slower), and derives a cold-start-aware phase written to /status: Pending -> Warming (process up, not yet able to serve) -> Ready (warm and serving).
FleetService — multi-node orchestration under preemption
apiVersion: inference.michelecampi.dev/v1alpha1
kind: FleetService
metadata:
name: gpufleet
spec:
model: Qwen/Qwen2.5-7B-Instruct
replicas: 2
hysteresis:
maxConcurrentReschedules: 1
template:
image: vllm/vllm-openai@sha256:... # digest-pinned
gpu: 1
healthPath: /health
runtimeClassName: nvidia
modelCacheHostPath: /opt/hf-cache # weights from local disk on reschedule
extraArgs: ["--max-model-len", "4096", "--gpu-memory-utilization", "0.90"]
The fleet controller places child VllmServices across nodes using warmth-first placement (the candidates are the Nodes nodePool.selector admits when it is set, otherwise the nodes with a NodeState; a node's warmth for the fleet's model is derived from the VllmServices the cluster runs there, and a NodeState can raise it; the reporter DaemonSet writes the measured signals into NodeState, and the preemption notice is set by hand wherever it is set in this repo; see ADR-0011), reacts to preemption notices with the surge-first sequence measured above, caps concurrent reschedules (hysteresis) to prevent thundering herds, and falls back to drain-and-hold when no healthy target exists. Reconciliation reads its own child resources as the source of truth, which eliminates oscillation from stale external state.
Architecture
src/lib.rs VllmService CRD, phase_for() lifecycle logic
src/main.rs VllmService controller: reconcile, Deployment apply, status
src/fleet_types.rs FleetService / NodeState CRDs, per-node phase machine
src/fleet_controller.rs fleet reconcile: placement, preemption pass, surge/drain
src/fleet_placement.rs warmth-first node selection (pure, unit-tested)
src/fleet_planning.rs greedy initial placement planner (pure, unit-tested)
src/metrics.rs Prometheus metrics
src/bin/crdgen.rs emits CRD YAML
deploy/ generated CRDs, examples
hack/rehearsal/ zero-cost kind harness: loadgen, analyze.py, run scripts
hack/gpu-session/ Lambda GPU session: bootstrap scripts, manifest, runs/
Built on kube-rs 2.x, k8s-openapi 0.26, Rust edition 2021, built and tested with Rust 1.95 only: rust-toolchain.toml pins it, and CI checks that the workflows, the Dockerfile builder and rust-version in Cargo.toml agree with it. The fleet controller .owns() its children and .watches() NodeState resources namespace-wide with a reactive mapper, so both spec changes and node condition changes retrigger reconciliation. Design decisions are documented as ADRs in the repo.
Install a release
From v0.4.0, a release tag carries a chart whose default image is the
operator built from the same commit, and CI and the release workflow check
that the crate, the chart and the tag agree. With Docker, kind, kubectl
and Helm:
kind create cluster --name vcso-release
git clone --branch v0.5.0 --depth 1 https://github.com/MicheleCampi/vllm-coldstart-operator
helm install vcso ./vllm-coldstart-operator/chart \
--namespace vllm-system --create-namespace --wait
kubectl wait vllmservice/ci-placeholder -n vllm-system \
--for=jsonpath='{.status.phase}'=Ready --timeout=120s
kubectl get vllmservice ci-placeholder -n vllm-system \
-o jsonpath='{.status.phase}: {.status.message}{"\n"}'
# Ready: 1/1 replicas ready and warm
To upgrade from 0.4.0, apply the release's CRDs before helm upgrade, since
Helm does not update them; the steps are in CHANGELOG.md,
under 0.5.0.
The chart's defaults install the operator, its three CRDs and one
VllmService, ci-placeholder: a pause container with no GPU and no health
endpoint, which is Ready as soon as its pod runs. It exercises the control
plane (reconcile, status, ownership), not inference. Verified on kind v0.30.0
(Kubernetes v1.34.0) with Helm v3.21.0 and kubectl v1.36.1, running
operator image 0.5.0.
On Kubernetes 1.34.0, the default node image of kind v0.30.0, registering
the CRDs prints unrecognized format warnings for their int32, int64
and float fields. That release warned on integer and number formats by
mistake; 1.34.1 fixed it (kubernetes#133901),
and on a 1.34.2 node the same CRDs register without warnings. The install
completes either way.
For GPU serving, override example in chart/values.yaml or apply
deploy/examples/qwen-7b.yaml on a cluster
with NVIDIA GPUs and the device plugin. Upgrading from 0.3.0: apply
chart/crds/crd.yaml from the new tag first, since Helm does not update CRDs
on upgrade.
Try it locally
Requires Docker, kind, kubectl, and a Rust toolchain.
# 1. Create a local cluster
kind create cluster --name operator-dev
# 2. Install the CRDs
cargo run --bin crdgen > deploy/crd.yaml
kubectl apply -f deploy/crd.yaml
# 3. Run the operator (talks to the cluster via your kubeconfig)
cargo run --bin vllm-coldstart-operator
# 4. In another shell, create a VllmService and watch the lifecycle
kubectl apply -f deploy/examples/ci-placeholder.yaml
kubectl get vllmservice ci-placeholder -o jsonpath='{.status.phase}: {.status.message}'
# Pending -> ... -> Ready (a pause container: no GPU, no health endpoint;
# deploy/examples/qwen-7b.yaml needs a GPU node and stays Pending on kind)
# 5. Delete it and watch the Deployment garbage-collect
kubectl delete vllmservice ci-placeholder
kubectl get deployment ci-placeholder # NotFound
The full preemption rehearsal (A/B/C topology, load, notice injection, analysis) runs on kind at zero cost: see hack/rehearsal/.
What is real and what is simulated
This section stays honest about boundaries, because the value is in what is actually exercised.
Real and measured: the control plane end-to-end (reconcile, server-side apply, GC, status machines), the fleet orchestration under preemption (measured on 3x A10 above), real vLLM serving with GPU scheduling (runtimeClassName, digest-pinned image, model cache on hostPath) — validated both on this fleet and on GKE with GPU node pools in a separate GitOps deployment. It also covers the per-node signal chain feeding NodeState.status: NVML energy and utilization plus vLLM prefix-cache scrape, joined into tokensPerJoule on the same reporting round, exercised in vivo on 3x A10 across 8 reps (evidence).
A measured bound, tested rather than published: the cost campaign on this workload derived a packing bound — how many trajectories a replica could host if generating segments never contended. That is an upper bound under declared non-interference, so ADR-0010 tested it against a running engine instead of exporting it as a capacity figure, with the falsification criterion fixed nine days before the node was booted. Six arms on 1xA10: observed running count 1.2434 against a predicted 1.2639 at N=2, BOUND SUPPORTED unanimously (evidence). The anchor arm was a gate rather than a warm-up and cleared it first, at 0.61 against an exclusion threshold of 0.90. The raw series then narrowed the claim — the count is almost never 1, sitting at 2 for 62% of samples and at 0 for the rest — 1.2434 is 2 x 0.62, not a smoothed overlap — so the trajectories march in lockstep and share their idle time rather than interleaving it. The prediction holds; the mechanism behind it is not the one the design assumed, and the interleaving case remains unmeasured.
Covered in CI, not just in a session: the e2e job on kind exercises both CRDs — VllmService end to end, and FleetService through placement, child ownership, the hostname pin the planner chose, the scale subresource ADR-0009 introduces, the node pool selector, the warmth derived from what the cluster runs, the status message of a fleet with no candidate, and garbage collection. It also restarts the operator over a live child and asserts the child survives with the same UID and the same metadata generation: recreation would cycle every replica on every upgrade, and a generation bump on an unchanged spec would mean each restart is a rollout. Another job, on a kind cluster with two workers, places a replica on one, signals a preemption notice there, and asserts that the replica moves to the other, a node Cold for its model, and that the child's Deployment carries the maxSurge: 1 / maxUnavailable: 0 strategy the move relies on. A third job serves a VllmService from the llm-d inference simulator and drives load through the Service the operator creates, asserting that every request is answered; it says nothing about latency. A fourth needs no cluster: it validates deploy/examples and the manifests in this README against the CRDs. No GPU in any of them.
**Driven by a