Run vLLM-TorchTPU on GKE¶
Use this guide when vLLM-TorchTPU runs on Google Kubernetes Engine rather than on a VM you log in to: a multi-host v7x slice served by one JobSet, or prefill and decode pools as separate roles. The vLLM-TorchTPU repository keeps production-tested JobSet manifests under .buildkite/kubernetes/manifests/workloads/; this guide says which to start from, what a manifest must declare itself, and the three GKE rules that make a slice work. Chapter 18 covers the engine, chapter 20 the llm-d stack that routes across such deployments, and Run TorchTPU on GKE the cluster, node pools and the JobSet controller.
Prerequisites¶
- A GKE cluster with a TPU node pool whose accelerator and topology match the slice,
kubectlpointed at it, and the JobSet controller installed: Run TorchTPU on GKE, steps 1 to 3 and 7. - A clone of
https://github.com/vllm-project/vllm-torchtpu.gitfor the manifests, and an image such asvllm/vllm-torchtpu:latest. - A persistent volume or Cloud Storage mount for the compilation caches.
Steps¶
1. Pick the reference manifest¶
| Manifest | Topology or use |
|---|---|
workloads/mp-multihost-slice.yaml |
Multi-host v7x slice with vLLM's native multiprocessing (mp) data and tensor parallelism, no Ray |
workloads/ray-multihost-slice.yaml |
Multi-host v7x slice that brings up a Ray cluster (JOB_COMPLETION_INDEX=0 head plus worker pods) |
workloads/qwen3.5-397b-1p1d.yaml |
One prefill, one decode (1P1D) for Qwen/Qwen3.5-397B-A17B with Raiden KV transfer |
workloads/qwen3.5-p8d8-disagg.yaml |
Multi-host P8D8 disaggregated serving for Qwen3.5 |
workloads/kimi-k3-1p1d-4dp8tp.yaml |
1P1D for Kimi-K3 (DP=4, TP=8) |
workloads/dsv4-pd-disagg.yaml |
Prefill and decode disaggregation for DeepSeek-V4 |
All paths are under .buildkite/kubernetes/manifests/. Manifests are named for what they contain: a model and topology, or a bring-up (ray-multihost-slice.yaml runs whatever command a step passes). The v7x/ directory predates them and no pipeline uses it.
Check: the manifest's nodeSelector names the accelerator and topology of your node pool.
2. Declare what is the manifest's own¶
The repository's rule is that a manifest states only the hardware it wants and what is genuinely its own:
nodeSelectorwithcloud.google.com/gke-tpu-accelerator(for exampletpu7xortpu-v6e-slice) andcloud.google.com/gke-tpu-topology(for example2x2x1,2x2x2,2x4x4), plus agoogle.com/tpucount: 4 chips per v7x host. These three choose the queue.- Its containers, and
activeDeadlineSecondswhen the default does not fit.
In the repository, everything else (cache mounts, the gcsfuse sidecar, the TPU toleration, the service account, restartPolicy, TTL, memory request and retry rules) comes from one JobSet annotation, tpu-ci.google.com/defaults: standard, which the project's CI fleet defines in kueue/launcher/pod_defaults.yaml of its ci-infra. On your own cluster nothing resolves that annotation, so declare those settings yourself. Do not add a CPU request: the vLLM-TorchTPU Kubernetes guide warns that one large enough to matter stops the pool from building nodes.
The reference mp multi-host JobSet:
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
annotations:
tpu-ci.google.com/defaults: standard
spec:
network:
enableDNSHostnames: true
replicatedJobs:
- name: slice
replicas: 1
template:
spec:
parallelism: ${MULTIHOST_HOSTS}
completions: ${MULTIHOST_HOSTS}
completionMode: Indexed
successPolicy:
rules:
- succeededIndexes: "0"
activeDeadlineSeconds: 28800
template:
spec:
nodeSelector:
cloud.google.com/gke-tpu-topology: ${MULTIHOST_TOPOLOGY}
cloud.google.com/gke-tpu-accelerator: tpu7x
containers:
- name: workload
image: ${IMAGE}
command: ["/bin/bash", "-lc"]
args:
- |
export VLLM_HOST_IP="$${POD_IP}"
readarray -d '' _args < <(printf '%s' "$${MULTIHOST_ARGS_B64}" | base64 -d)
exec bash .buildkite/kubernetes/mp_multihost_entry.sh "$${_args[@]}"
env:
- name: HEAD_HOST
value: ${WORKLOAD_NAME}-slice-0-0.${WORKLOAD_NAME}
- name: NUM_HOSTS
value: "${MULTIHOST_HOSTS}"
- name: DP_LOCAL
value: "8"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HF_DATASETS_CACHE
value: /cache/hf/hub/datasets
- name: VLLM_XLA_CACHE_PATH
value: /cache/jax/xla
- name: VLLM_CACHE_ROOT
value: /cache/jax/vllm
ports:
- containerPort: 8000
resources:
limits:
google.com/tpu: "4"
requests:
google.com/tpu: "4"
volumeMounts:
- name: vllm-profile-cache
mountPath: /cache/jax/vllm/profile_cache
volumes:
- name: vllm-profile-cache
emptyDir:
medium: Memory
sizeLimit: 16Gi
What the fields do, from the manifest's own comments:
${WORKLOAD_NAME}and${IMAGE}are substituted, and the repository'srun_multihost.shsuppliesMULTIHOST_TOPOLOGY,MULTIHOST_HOSTSandMULTIHOST_ARGS_B64(the serve arguments thatmp_multihost_entry.shruns). A literal dollar is written$$.enableDNSHostnamesgives each pod the name<jobset>-slice-0-<index>, from whichHEAD_HOSTis built.DP_LOCALis 8 because a v7x host has 8 devices, so the config's data parallelism is eight per host.POD_IPis what each host publishes into the rendezvous from which the others buildTORCH_TPU_SLICEBUILDER_ADDRESSES.successPolicyends the JobSet when index 0, the head, succeeds, so workers do not hold their chips after the head exits.activeDeadlineSeconds: 28800is eight hours, over the fleet's three-hour default, "because these models compile for the better part of an hour before the sweep starts".
Check: the rendered manifest has no ${...} left, the nodeSelector matches the node pool, and google.com/tpu equals the chips per host.
3. Put the caches on persistent storage¶
Point VLLM_XLA_CACHE_PATH and VLLM_CACHE_ROOT at a persistent volume or a Cloud Storage mount, not the container's root disk; the default for VLLM_CACHE_ROOT is under $HOME on the node's boot disk, which it does not fit on. Keep profile_cache (under VLLM_CACHE_ROOT) on an in-memory emptyDir, as the manifest does, so the free-HBM probe runs fresh on every start. A persisted profile_cache makes a later run load the kv=0 graph instead of compiling it, and the probe measures nothing.
Check: after the first run, the cache paths hold compiled artifacts, and the second start of the same workload is shorter (Keep compiled programs across restarts).
4. Apply and watch¶
Apply the rendered manifest, as the vLLM-TorchTPU profiling guide does for its own manifests, and watch the pods with the commands from Run TorchTPU on GKE:
kubectl apply -f mp-multihost-slice.yaml
kubectl get jobset,pods -n default
Check: one pod per host is scheduled onto the same slice and reaches Running, and vllm serve in the head pod (index 0) logs Application startup complete.
The three GKE rules¶
- Indexed completion for multi-host slices. Set
completionMode: Indexed,parallelism: <NUM_HOSTS>andcompletions: <NUM_HOSTS>on thereplicatedJobstemplate, andenableDNSHostnames: trueon the JobSet. GKE places all pods of one indexed Job on one interconnected slice with stable DNS names (<jobset>-slice-0-0.<jobset>). Two Jobs asking for one shape get two slices with no interconnect between them. - TPU node selectors. Set both
cloud.google.com/gke-tpu-acceleratorandcloud.google.com/gke-tpu-topology, withgoogle.com/tpulimits (4 chips per v7x host). - Persistent caches.
VLLM_XLA_CACHE_PATHandVLLM_CACHE_ROOTon persistent storage,profile_cacheonemptyDirwithmedium: Memory.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
| The node pool never scales up for the pods | A CPU request on the container, checked against the autoscaler's node template | Request only google.com/tpu |
| Hosts of one engine cannot reach each other | Two Jobs for one slice shape, which GKE places as two slices | One indexed Job with parallelism and completions equal to the host count |
| Workers keep their chips after the head finished | No successPolicy on index 0 |
successPolicy.rules: [{succeededIndexes: "0"}] |
| The JobSet is killed before serving starts | Compiles exceed the deadline | Raise activeDeadlineSeconds (the reference uses 28800); persist the caches |
| The free-HBM probe at startup measures nothing; KV cache sized wrongly | profile_cache persisted between runs |
Mount profile_cache on an in-memory emptyDir |
| Pod evicted or out of ephemeral storage | Caches or datasets on the boot disk | Caches on a persistent volume; HF_DATASETS_CACHE under the mounted path |
kubectl apply rejects the JobSet |
JobSet controller missing | Install it (Run TorchTPU on GKE) |