Skip to content

Manage llm-d traffic and tenants

Use this guide when several tenants, priorities or models share TPU pools: flow control queues saturated traffic in the EPP by priority and fairness instead of in each engine, separate InferencePools serve models side by side, and the Inference Payload Processor routes many models and LoRA adapters behind one endpoint. All of it is router-side and accelerator independent; the TPU part is the model servers underneath. Chapter 21 explains the mechanisms.

Prerequisites

  • A TPU model-server overlay from the optimized baseline (flow control reuses it).
  • The repository and environment from the quickstart; for flow control, GUIDE_NAME, NAMESPACE, ROUTER_VALUES (guides/flow-control/router/flow-control.values.yaml) and MODEL_NAME as in the upstream flow-control guide.
  • The router pod requests 8 vCPU and 16 GiB (4 vCPU and 8 GiB each for EPP and Envoy): a CPU node must have that allocatable.

Steps

1. Install the CRDs, the router with flow control, and TPU model servers

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api-inference-extension/${GAIE_URL}/v1-manifests.yaml
kubectl apply -f https://github.com/llm-d/llm-d-router/${ROUTER_RELEASE_URL}/manifests.yaml

helm upgrade --install ${GUIDE_NAME} \
    ${ROUTER_STANDALONE_CHART} \
    -f ${REPO_ROOT}/guides/recipes/router/base.values.yaml \
    -f ${ROUTER_VALUES} \
    ${EXTRA_HELM_ARGS} \
    -n ${NAMESPACE} --version ${ROUTER_CHART_VERSION}

The guide renders the optimized-baseline overlay and relabels it; it defaults to NVIDIA GPU and says other accelerators are substituted by swapping the kustomize path. For v6e:

kubectl kustomize ${REPO_ROOT}/guides/optimized-baseline/modelserver/tpu/v6/vllm/gke/ \
  | sed "s/optimized-baseline/${GUIDE_NAME}/g" \
  | kubectl apply -n ${NAMESPACE} -f -

The served model then is the TPU overlay's (Qwen/Qwen3-32B on v6e, Qwen/Qwen3.5-397B-A17B-FP8 on tpu/v7); set MODEL_NAME to it.

Check: the gate is on:

kubectl logs deploy/${GUIDE_NAME}-epp -c epp -n ${NAMESPACE} | grep "Initializing Flow Control layer"

One line; the stronger check is that llm_d_epp_flow_control_* series exist on the EPP's /metrics.

2. Define priority bands and tag requests

kubectl apply -f ${REPO_ROOT}/guides/${GUIDE_NAME}/objectives.yaml -n ${NAMESPACE}

The file defines Premium (priority 100), Standard (0) and Best-Effort (-10) InferenceObjectives. Clients pick a band and a tenant with two headers, from a pod inside the cluster:

curl -X POST http://${IP}/v1/completions \
  -H 'Content-Type: application/json' \
  -H 'x-llm-d-inference-fairness-id: tenant-a' \
  -H 'x-llm-d-inference-objective: premium-traffic' \
  -d "{
    \"model\": \"${MODEL_NAME}\",
    \"prompt\": \"Say hello\"
  }"

In production, the ingress gateway strips every incoming x-llm-d-* header, validates the API key or JWT, and injects authoritative ones from its claims; otherwise any client can promote itself.

Check: from the same pod, the request is counted in the premium band:

TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
curl -s -H "Authorization: Bearer ${TOKEN}" http://${GUIDE_NAME}-epp:9090/metrics \
  | grep 'llm_d_epp_flow_control_request_queue_duration_seconds_count' \
  | grep 'priority="100"'

A series with fairness_id="tenant-a", priority="100" and a count of at least 1. Only a priority="0" series growing means the objective headers are ignored: check objectives.yaml is applied and its poolRef matches kubectl get inferencepools -n ${NAMESPACE}.

3. Tune the dispatch gate for your TPU slice

The defaults (global-strict-fairness-policy, fcfs-ordering-policy, utilization-detector) keep legacy strict FCFS order. The flow-control guide recommends concurrency-detector in production to avoid telemetry lag; the KEDA design page calls utilization-detector the recommended default. Choose by workload: utilization tracks real KV memory and suits varied context lengths; concurrency reacts at once to bursts but is blind to KV pressure. For the concurrency detector, set three layers: the engine limit \(N\) (vllm serve ... --max-num-seqs <N>), the EPP maxConcurrency \(= N + B\) with a small lookahead \(B\), and a burst queue maxRequests of 200 or more. Derive them on your slice with the tuning wizard from measured throughput, latency, KV blocks and your ISL and OSL distributions:

python3 guides/flow-control/scripts/tuning_wizard.py \
  --throughput 12.5 \
  --latency-sec 3.45 \
  --gpu-blocks 21875 \
  --block-size 16 \
  --isl-mean 4000 \
  --isl-std 1500 \
  --osl-mean 800 \
  --osl-std 300 \
  --shared-prefix 3000 \
  --enable-prefix-caching \
  --z-score 2.0

The numbers are the guide's example; run it without arguments for the interactive mode, and pass your TPU engine's KV block count and block size. The shipped maxConcurrency fits Qwen3-32B on H100 at TP=2 only. Flow-control state is per EPP replica.

Check: under a burst, Q27 (queue size by priority) holds requests in the EPP while engine queues (Q12) stay short, and Q29 shows RejectedCapacity only beyond maxRequests.

4. Serve several models side by side

Each extra model gets its own Helm release (its own InferencePool and EPP) with a unique router.modelServers.matchLabels:

export RELEASE=model-b
export VALUES=model-b.values.yaml
kubectl annotate configmap envoy -n ${NAMESPACE} \
  meta.helm.sh/release-name=model-b meta.helm.sh/release-namespace=${NAMESPACE} --overwrite
kubectl label configmap envoy -n ${NAMESPACE} \
  app.kubernetes.io/managed-by=Helm --overwrite
helm install ${RELEASE} \
  ${ROUTER_STANDALONE_CHART} \
  -f ${REPO_ROOT}/guides/recipes/router/base.values.yaml \
  -f ${REPO_ROOT}/guides/workload-autoscaling/multi-inference-pool/${VALUES} \
  -n ${NAMESPACE} --version ${ROUTER_CHART_VERSION}

The two envoy ConfigMap commands work around the standalone chart's fixed ConfigMap name, which otherwise fails the second install. Deploy that model's TPU servers with pod labels that match the values file's matchLabels. Give each pool its own ScaledObject whose queries isolate its EPP (service and pool labels, not model_name alone).

Check:

kubectl get inferencepools,svc -n ${NAMESPACE}
kubectl get pods -n ${NAMESPACE} --show-labels

Each pool's selector matches only its own pods; llm_d_epp_ready_endpoints per pool equals its pod count.

5. Many models behind one endpoint

The Inference Payload Processor (IPP) maps the request body's model name to its base model and sets X-Gateway-Base-Model-Name, which HTTPRoutes match to a pool; LoRA adapters ride on their base model's pool. It needs Gateway mode (the guide's install targets Istio). Follow llm-d's multi-model routing guide for its install, model-mapping ConfigMaps and routes.

Check: requests naming two base models land on two pools (Q23 per endpoint).

Troubleshooting

Symptom Cause Fix
No Initializing Flow Control layer line Gate off (the EPP logs Flow Control layer is disabled) Router values with flowControl; reinstall
Router pod Pending, Insufficient cpu No node with 8 vCPU allocatable Larger CPU node pool
Premium requests counted as priority 0 Objectives not applied, or poolRef mismatch Apply objectives.yaml; match the pool name
Second Helm release fails on ConfigMap ownership Fixed envoy ConfigMap name The annotate and label workaround
A pool has no endpoints Pod labels differ from matchLabels Align the labels
Pool scales on another tenant's traffic Trigger query not pinned to its EPP Add service and pool labels
Clients jump the queue Tenant headers not stripped at the edge Strip and re-inject at ingress

References