Roll out changes to an llm-d pool¶
Use this guide before you change anything a serving pod runs: the image, flags, model, adapter, slice shape or TPU generation. LLM requests run long and cannot migrate, new TPU pods are slow and cold (weights plus XLA compilation), and TPU node pools are fixed-size, so the guides' strategy: Recreate turns any template change into a full outage. This page sets up the drain and probes every strategy depends on, then gives the four llm-d strategies. Chapter 21 explains the choice; chapter 20's companion manifests carry the probe and drain values used here.
Prerequisites¶
- A deployed llm-d path on TPU (Optimized baseline or P/D disaggregation).
- For blue-green: Gateway mode (a GKE
Gateway, quickstart, step 7). - Images pinned by tag or digest: pods on different builds cannot exchange KV.
Steps¶
1. Make pods ready only when the model is loaded¶
Probe /v1/models for startup and readiness, /health for liveness only: /health says the process is up, not that the model is loaded. On decode pods, probe the engine port 8200, not the routing sidecar's 8000. The values in the companion manifest code/ch20_llm_d/manifests/baseline-v6e/modelserver.yaml:
startupProbe:
httpGet:
path: /v1/models
port: 8000
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 120
readinessProbe:
httpGet:
path: /v1/models
port: 8000
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet:
path: /health
port: 8000
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
The probe guide's example uses failureThreshold: 60 (30 minutes); the book's manifest doubles it to 60 minutes for a cold TPU compile. Size failureThreshold x periodSeconds above your worst measured cold start (Startup).
Check: kubectl get pods -n ${NAMESPACE} -w shows a new pod Running but not ready until the model loads; kubectl describe pod -n ${NAMESPACE} <pod> | grep -A 10 "Liveness:" shows the probes.
2. Drain in-flight requests on termination¶
| Setting | Aggregated (guides' default, TPU overlays included) | P/D disaggregated |
|---|---|---|
preStop sleep |
15 s | 20 s |
--shutdown-timeout |
45 | 90 |
terminationGracePeriodSeconds |
75 (15 + 45 + 15 teardown) | 150 |
The preStop sleep keeps the engine up while requests already routed arrive (and, on prefill, while decode pulls finished KV); --shutdown-timeout makes vLLM finish in-flight requests on SIGTERM instead of aborting; the grace period must exceed both or SIGKILL cuts the drain. On P/D decode pods the routing proxy runs as a native sidecar (initContainer with restartPolicy: Always) so it outlives the draining engine. Set the timeout near the p99 request duration you want to finish, and exec vllm serve if a shell wraps it. python code/ch20_llm_d/validate_manifests.py your-dir/ rejects missing or inconsistent drain settings.
Check: start a long generation against one pod, then:
kubectl delete pod -n ${NAMESPACE} <pod-name>
kubectl logs -n ${NAMESPACE} <pod-name> --tail=50 | grep -iE "shutdown|drain|abort|SIGTERM"
kubectl get pod -n ${NAMESPACE} <pod-name> -w
The request completes, and the pod exits before the grace period ends (no SIGKILL).
3. Choose a strategy for TPU¶
| Strategy | Blast radius | Rollback | TPU cost |
|---|---|---|---|
Recreate (the guides' default) |
everyone, full outage while new pods load and compile | another cold start | none |
Rolling update, maxSurge: 0, maxUnavailable: 1 |
reduced capacity, no outage | slow | none |
| Rolling update with surge | users at random | slow | a spare slice per surge pod |
| Blue-green (step 4) | exactly the weight you set | instant | a second pool for the duration |
| LoRA adapter (step 5) | the adapter's users | instant | none |
| P/D-safe (step 6) | per revision | revert or rescale | each role's maxSurge, or a canary shape |
A surge pod on a fixed-size TPU pool stays Pending until a node frees. Blue-green is also the strategy for a new TPU generation or slice shape, a new base model or a new serving framework.
Check: you know how many spare slices the strategy needs and have them, or chose a zero-surge one.
4. Blue-green between two InferencePools¶
Deploy the new model servers and a second Helm-managed InferencePool with a new name and selector (the green pool). Then split traffic in the HTTPRoute:
kubectl edit httproute llm-route -n ${NAMESPACE}
rules:
- backendRefs:
- group: inference.networking.k8s.io
kind: InferencePool
name: vllm-qwen3-32b
weight: 90
- group: inference.networking.k8s.io
kind: InferencePool
name: vllm-qwen3-32b-new
weight: 10
matches:
- path:
type: PathPrefix
value: /
Move the weights through 1%, 5%, 10%, 50% and 100%, judging the green pool by its own metrics at each step (where the gateway supports it, a RequestMirror filter can first copy traffic to green and discard the responses). Finish with the green pool alone at weight 100, then remove the old pool with helm uninstall <old-inference-pool-name> -n ${NAMESPACE}. Rollback is setting green's weight back to 0.
Check: the green pool's request rate matches its weight (Q23 per endpoint in Observability) and its error ratio (Q08) stays flat.
5. Roll out a LoRA adapter¶
Install the InferenceModelRewrite CRD and map a stable model name to adapter versions; vLLM loads adapters at runtime:
source ${REPO_ROOT}/guides/env.sh
kubectl apply -f https://github.com/llm-d/llm-d-router/${ROUTER_RELEASE_URL}/manifests.yaml
apiVersion: llm-d.ai/v1alpha2
kind: InferenceModelRewrite
metadata:
name: small-segment-lora-rewrite
spec:
poolRef:
group: inference.networking.k8s.io
name: vllm-qwen3-32b
rules:
- matches:
- model:
type: Exact
value: small-segment-lora
targets:
- modelRewrite: "small-segment-lora-v1"
weight: 90
- modelRewrite: "small-segment-lora-v2"
weight: 10
Step the weights 100/0, 90/10, 50/50, 0/100. Set poolRef.name to your pool.
Check: the guide's test-traffic script reports a split close to the weights (17 and 3 of 20 at 90/10 in its run).
6. Roll out a disaggregated deployment safely¶
A request spans a prefill and a decode pod; if they run different versions the KV transfer can fail or return a 200 with wrong output. Add the disaggregatedset-rollout-screener (Alpha) to the top-level plugins of the EPP config and upgrade the router:
router:
epp:
flags:
allow-experimental-plugins: true
pluginsCustomConfig:
pd-config.yaml: |
apiVersion: llm-d.ai/v1
kind: EndpointPickerConfig
plugins:
- type: disaggregatedset-rollout-screener
parameters:
scope:
labelSelector: "disaggregatedset.x-k8s.io/name=pd-disagg-vllm"
revisionGating:
mode: max-role
requiredRoles: [prefill, decode]
# ...the existing plugins, unchanged
On TPU7x the set is pd-disagg-tpu (P/D disaggregation); use its name in the selector. Then change the set's template (image, flags) and apply it; each role moves within its maxSurge and maxUnavailable (defaults 0 and 1):
export SET=pd-disagg-tpu
wait_ds() {
local gen
gen=$(kubectl get disaggregatedset "$1" -n ${NAMESPACE} -o jsonpath='{.metadata.generation}')
kubectl wait disaggregatedset/"$1" -n ${NAMESPACE} \
--for=jsonpath='{.status.observedGeneration}'="${gen}" --timeout=120s
kubectl wait disaggregatedset/"$1" -n ${NAMESPACE} --for=condition=Available --timeout=1800s
}
kubectl apply -n ${NAMESPACE} -k <your-overlay>
kubectl get leaderworkerset -n ${NAMESPACE} -l disaggregatedset.x-k8s.io/name=${SET}
wait_ds ${SET}
For a step-by-step canary, run each version as its own DisaggregatedSet and move traffic by patching replicas (2P+2D against 1P+1D sends about two thirds to the larger set under max-role).
Check: responses carry x-llm-d-disagg-revision; kubectl get pods -n ${NAMESPACE} -l llm-d.ai/guide=pd-disaggregation -L disaggregatedset.x-k8s.io/revision,llm-d.ai/role shows both revisions; Q38 (llm_d_epp_disaggregatedset_revision_gating_share) follows the fleet and Q39 counts no fail-closed requests.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
| Every template change is an outage | strategy: Recreate |
maxSurge: 0, maxUnavailable: 1, or blue-green |
New pod Pending during a rollout |
Surge on a fixed-size TPU pool | Zero-surge strategy or spare capacity |
| Pod restarted mid-compile | startupProbe budget too short |
Raise failureThreshold above the cold start |
| Pod receives traffic before the model loads | Readiness on /health |
/v1/models for startup and readiness |
| Requests fail during scale-down or rollout | No --shutdown-timeout, grace too short, or a shell swallows SIGTERM |
The drain table; exec the server |
| Decode logs KV transfer failures right after a prefill pod is deleted | Prefill left before decode pulled | Raise the prefill preStop sleep |
503 with screeners eliminated all endpoint candidates |
No revision has a Ready pod of every required role | Keep one complete revision Ready |
| KV transfers fail within one version | Pods on different image builds | Pin by digest |
References¶
- llm-d: Roll Out Updates Safely
- llm-d: Blue-Green Update
- llm-d: LoRA Adapter Rollout
- llm-d: Safe Rollouts of Disaggregated Deployments with DisaggregatedSet
- llm-d: Graceful Shutdown & Request Draining
- llm-d: vLLM Model-Aware Readiness Probes
- llm-d: Deploy an Optimized Baseline
- Companion code: code/ch20_llm_d/
- Chapter 21: Operating llm-d: autoscaling, rollouts, observability