In front of a language model server, a Kubernetes Service sends requests without looking at the queue or the cache of each replica: a saturated replica keeps receiving them. The Gateway API Inference Extension fixes this. An InferencePool groups the replicas, and an endpoint picker chooses, request by request, the one that must answer, based on its metrics. This lesson shows it with Istio 1.32.0 and a simulated model server, with no GPU, on three replicas of which one is saturated. It is for readers who already operate a Gateway and need to route inference traffic through it.
What you will learn
- Explain why a Service distributes inference requests badly.
- Say what the
InferencePooland the endpoint picker add to a Service. - Check that the Inference Extension is enabled in Istio.
- Declare an
InferencePooland route anHTTPRouteto it. - Read the distribution of requests according to the replicas' load.
- Diagnose a route that does not reach the pool.
Prerequisites
- The Gateway API over HTTPS lesson, which installs Istio 1.32 in ambient mode, presents the Istio Gateway, the
ClusterIPannotation and how to read a Gateway's conditions. This lesson reuses them without detailing them again. - The Gateway API lesson for
GatewayandHTTPRoute. - The Serving an LLM: batching and throughput lesson (in French), which explains the KV cache and the load of an inference server. The next section recaps the essentials.
Why does a Service distribute inference traffic badly?
An inference request can last a few hundred milliseconds or several seconds, depending on the length of the text sent and of the text generated. A Service, for its part, knows neither the queue nor the cache of its replicas. Two states of a replica nevertheless change everything: the length of its queue, and the fill rate of its KV cache, the memory where the server keeps the context of each request in progress.
A replica whose queue holds 40 requests and whose cache is 97% full answers slowly, but a Service does not see it.
Behind an Istio Gateway, the proxy distributes by default according to the number of requests in progress on each replica (the LEAST_REQUEST algorithm), not according to the server's queue or cache. When requests are short and sent one at a time, this number stays close to zero everywhere. With three replicas, the saturated replica therefore receives a share close to the others'. This lesson's measurement, further down, confirms it: behind an ordinary Service, it receives 8 requests out of 30, or 27%. This share can drop if many requests arrive at the same time, because a slow replica accumulates them.
To avoid this, the Gateway must know the state of each replica at the moment the request arrives.
What do the InferencePool and the endpoint picker change?
The InferencePool is the equivalent of a Service for inference: it groups the model's Pods with a label selector and a port. It adds a designation, endpointPickerRef, which points to a Service, the endpoint picker. This picker reads the replicas' metrics and tells the Gateway which one must take each request.
On the diagram below, first follow the arrow from the picker to the replicas: the metrics are read outside the request. Then follow the client's request: the decision is made on every request.
The HTTPRoute no longer targets a Service: its backendRef designates the InferencePool, which triggers the picker lookup.
Which versions does the demonstration use?
The demonstration runs on the kubeadm cluster of the lab catalog, measured on 2026-11-16. Istio is on version 1.32.0 there, in ambient mode, Kubernetes on v1.37.2 and the Gateway API on v1.6.1. The endpoint picker is the Inference Extension image registry.k8s.io/gateway-api-inference-extension/epp:v1.5.0@sha256:86c679b057298e68c6e65ff5603e92066d432e77b11f1f81f0a06399694810bc, and the simulated model server is ghcr.io/llm-d/llm-d-inference-sim:v0.7.1@sha256:74211b5dbf27a867fcefae92067701e0a5fcee827f95156d89718bf3e1bfb845. The InferencePool type comes from a Gateway API extension, installed by a CRD whose annotation gives the version.
istioctl versionkubectl get crd inferencepools.inference.networking.k8s.io -o jsonpath='{.metadata.annotations.inference\.networking\.k8s\.io/bundle-version}{"\n"}'client version: 1.32.0control plane version: 1.32.0data plane version: 1.32.0 (3 proxies)v1.5.0-rc.2The lab installs the published v1.5.0 version of the extension, the one Istio 1.32.0 embeds in its code. The manifests.yaml file of this version nevertheless still carries the v1.5.0-rc.2 mention in the inference.networking.k8s.io/bundle-version annotation, hence the output above. The lab installs four CRDs of the extension, all from this file. Only InferencePool is in API version v1: the other three are still alpha.
inferencemodelrewrites.inference.networking.x-k8s.io bundle-version=v1.5.0-rc.2 versions=v1alpha2inferenceobjectives.inference.networking.x-k8s.io bundle-version=v1.5.0-rc.2 versions=v1alpha2inferencepoolimports.inference.networking.x-k8s.io bundle-version=v1.5.0-rc.2 versions=v1alpha1inferencepools.inference.networking.k8s.io bundle-version=v1.5.0-rc.2 versions=v1The Istio 1.32 documentation suggests something else: it installs v1.0.1 of the extension, with kubectl kustomize "github.com/kubernetes-sigs/gateway-api-inference-extension/config/crd?ref=v1.0.1". What the documentation says and what the lab installs are two distinct facts. As of 2026-11-16, the latest published version of the extension is v1.6.2; the lab stays on v1.5.0, the version Istio 1.32.0 is compiled against. To reproduce this lesson, install v1.5.0: its manifests.yaml file contains the four CRDs, and nothing else.
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api-inference-extension/releases/download/v1.5.0/manifests.yamlAnother version of the CRDs does not necessarily have the same fields. Before reusing an example found online, compare the version of the manifests you applied with that of the example. The bundle-version annotation helps, but it can lag behind the version, as here.
How do you enable the Inference Extension in Istio?
For Istio to understand the backendRef of an InferencePool, the ENABLE_GATEWAY_API_INFERENCE_EXTENSION environment variable of its control plane (pilot, in the istiod Deployment) must be true. The Istio 1.32 documentation sets the two variables SUPPORT_GATEWAY_API_INFERENCE_EXTENSION and ENABLE_GATEWAY_API_INFERENCE_EXTENSION at installation, with --set values.pilot.env.SUPPORT_GATEWAY_API_INFERENCE_EXTENSION=true and --set values.pilot.env.ENABLE_GATEWAY_API_INFERENCE_EXTENSION=true. The lab cluster has already set both; the following command reads them.
kubectl -n istio-system set env deploy/istiod --list | grep -i INFERENCEENABLE_GATEWAY_API_INFERENCE_EXTENSION=trueSUPPORT_GATEWAY_API_INFERENCE_EXTENSION=trueThe grep -i filter keeps only these two variables. What happens if the extension is switched off? Set ENABLE_GATEWAY_API_INFERENCE_EXTENSION to false, let istiod redeploy, then recreate the pool, the Gateway and the route to the pool. The route is accepted, but its reference to the pool does not resolve, and a request fails. The HTTPRoute conditions say where:
Accepted=True reason=Accepted message=Route was validResolvedRefs=False reason=InvalidKind message=InferencePool is not enabled. To enable, set ENABLE_GATEWAY_API_INFERENCE_EXTENSION to true in istiodResolvedWaypoints=True reason=ResolvedWaypoints message=All waypoints resolvedRead ResolvedRefs=False: the reason is InvalidKind and the message names the variable to set to true, while Accepted stays True. The InferencePool itself has no condition (its status.parents is empty). A request sent through the Gateway receives HTTP/1.1 500 Internal Server Error, with server: istio-envoy and content-length: 0.
The istiod log says nothing about the extension: the only lines that mention inference designate the Gateway's namespace, for configuration pushes and the Gateway's reconciliation. The ResolvedRefs condition message is therefore the only clue. The false value of ENABLE_GATEWAY_API_INFERENCE_EXTENSION is enough to switch the extension off. Set it back to true to restore the setup, and also set SUPPORT_GATEWAY_API_INFERENCE_EXTENSION, as the Istio documentation does.
How do you declare the InferencePool and the route?
The lab's model server runs in the inference namespace. It is a vLLM simulator, with no GPU, that answers the /v1/completions API on port 8000. It is made of two Deployments, modele-libre (two replicas) and modele-sature (one replica), all labeled app: modele. The endpoint picker, a Deployment and a Service named selecteur, listens on port 9002. These manifests are deployed by the lab, when you launch dsoxlab run k8s-router-des-requetes-d-inference: outside the lab, the rest of the lesson can be read, but not replayed as is.
kubectl -n inference get pods -l app=modele -L chargeOn the demonstration cluster, the two modele-libre replicas carry the suffixes 2h55w and 9szdf, the modele-sature one the suffix qzc74: the suffixes change with every installation. The CHARGE column is a lab label, which is libre or saturee and exists only to show you which of the three replicas is saturated.
The pool does not read this label: it takes all three replicas, the saturated one included, through app: modele. Excluding the saturated one by hand would be a frozen choice, while the load changes from one minute to the next. It is up to the picker to avoid it by reading its metrics, and it can only avoid a replica it sees.
apiVersion: inference.networking.k8s.io/v1kind: InferencePoolmetadata: name: pool-modele namespace: inferencespec: selector: matchLabels: app: modele targetPorts: - number: 8000 endpointPickerRef: name: selecteur port: number: 9002In this lab, the endpoint picker is launched to wait for an InferencePool named pool-modele: it stays not ready as long as this pool does not exist. Once the pool is created, the selecteur Deployment becomes ready.
The Gateway and the route reuse what the previous lesson showed. The Gateway carries an HTTP listener on port 80 and the ClusterIP annotation, since the cluster has no load balancer. The route designates the pool in backendRefs, with its group and its kind.
apiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata: name: passerelle-ia namespace: inference annotations: networking.istio.io/service-type: ClusterIPspec: gatewayClassName: istio listeners: - name: http port: 80 protocol: HTTP---apiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata: name: route-modele namespace: inferencespec: parentRefs: - name: passerelle-ia sectionName: http rules: - backendRefs: - group: inference.networking.k8s.io kind: InferencePool name: pool-modeleA backendRef to an ordinary Service, in place of the pool, would not consult the endpoint picker. Apply the three objects, then read them. kubectl -n inference rollout status deploy/selecteur waits for the picker to become ready.
kubectl -n inference get inferencepool,gateway,httprouteNAME AGEinferencepool.inference.networking.k8s.io/pool-modele 16s
NAME CLASS ADDRESS PROGRAMMED AGEgateway.gateway.networking.k8s.io/passerelle-ia istio passerelle-ia-istio.inference.svc.cluster.local True 16s
NAME HOSTNAMES AGEhttproute.gateway.networking.k8s.io/route-modele 16sLook at PROGRAMMED True on the Gateway: the cluster has indeed programmed it. Once the pool was created, the picker became ready, which rollout status confirms with deployment "selecteur" successfully rolled out.
How do you read the distribution of requests?
Each response from the simulator carries the x-inference-pod header, which gives the name of the Pod that served it. The simulator sets this header, on every response, even when called directly, with no Gateway or Service: it therefore does not prove that the picker chose. What proves it is the distribution, meaning the number of requests received by the saturated replica.
The command below sends thirty requests to the ClusterIP address of the Service Istio creates for the Gateway. It reads it itself into the IP variable; the CLUSTER-IP column of kubectl -n inference get svc -l gateway.networking.k8s.io/gateway-name=passerelle-ia gives the same address. The text changes with every request, because the picker can also favor the replica that has already seen the same beginning of text (this is its prefix scorer, which tries to reuse the cache that is already filled): identical texts would skew the measurement.
IP=$(kubectl -n inference get svc -l gateway.networking.k8s.io/gateway-name=passerelle-ia -o jsonpath='{.items[0].spec.clusterIP}'); for i in $(seq 1 30); do curl -s -o /dev/null -D - --max-time 20 -H 'Content-Type: application/json' -d "{\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"prompt\":\"Pool $i $(date +%s%N)\",\"max_tokens\":8}" http://$IP/v1/completions | tr -d '\r' | grep -i '^x-inference-pod:'; done | sort | uniq -c 20 x-inference-pod: modele-libre-6cbb5d7f6d-2h55w 10 x-inference-pod: modele-libre-6cbb5d7f6d-9szdfCount the lines: 20 + 10 = 30, so each request got an answer from a replica, since a request left unanswered would show no header. This command does not display the HTTP code: the validation, described further down, requires a 200 code. 20 responses come from one free replica and 10 from the other. The saturated replica, modele-sature-69c5787c54-qzc74 on this installation, does not appear: it receives 0 requests.
The saturated replica is not slower than the others, because its metrics are simulated (--fake-metrics: 40 requests waiting, KV cache at 97%). It is the picker that avoids it by reading these metrics, not a real delay.
What does an ordinary Service give behind the same Gateway?
To compare, you keep the Gateway and replace the route's backendRef with an ordinary Service placed in front of the same three replicas. The route stays accepted, only the destination changes.
kubectl -n inference apply -f - <<'EOF'apiVersion: v1kind: Servicemetadata: name: modele namespace: inferencespec: selector: app: modele ports: - port: 8000 targetPort: 8000EOFkubectl -n inference patch httproute route-modele --type=json -p '[{"op":"replace","path":"/spec/rules/0/backendRefs/0","value":{"kind":"Service","name":"modele","port":8000}}]'Rerun the same loop of thirty requests. The table puts the two recorded distributions side by side.
| Route destination | Free 2h55w | Free 9szdf | Saturated qzc74 |
|---|---|---|---|
InferencePool pool-modele | 20 | 10 | 0 |
Ordinary modele Service | 9 | 13 | 8 (27%) |
Look at the last column: behind the Service, the saturated replica receives 8 requests out of 30, a share close to the others'. Behind the pool, it receives 0. The numbers 20 and 10 are not equal: the choice follows the metrics, not a round robin. Your distribution between the two free replicas will differ; what matters is the saturated replica's share, at most 3 requests out of 30 for the lab to pass. In both cases, the 30 responses carry the x-inference-pod header: it does not distinguish the two setups.
How do you recognize a response that went through the picker?
A response that went through the pool carries two traces of its own, which the Service does not add. The processing of the picker's responses sets x-went-into-resp-headers: true, a header its code reserves for debugging, and the response arrives in transfer-encoding: chunked, whereas behind the Service it keeps a content-length. You read them with curl -D - on one request.
curl -s -o /dev/null -D - -H 'Content-Type: application/json' -d '{"model":"meta-llama/Llama-3.1-8B-Instruct","prompt":"entetes 1","max_tokens":8}' http://$IP/v1/completions | tr -d '\r'HTTP/1.1 200 OKx-envoy-upstream-service-time: 0x-went-into-resp-headers: trueserver: istio-envoycontent-type: application/jsonx-inference-port: 8000date: Mon, 16 Nov 2026 12:47:29 GMTx-inference-pod: modele-libre-6cbb5d7f6d-2h55wx-inference-namespace: inferencetransfer-encoding: chunkedLook for x-went-into-resp-headers and transfer-encoding: chunked. Behind the ordinary Service, the same command returns content-length: 323 and neither of these two lines. To get back to the lab setup, put the backendRef back on the pool (the route's group, kind and name above) and delete the modele Service.
Troubleshooting
The route or the measurement does not give the expected result? The table goes from the symptom back to the cause, in the order in which it is quickest to check.
| Symptom | Likely cause | Fix |
|---|---|---|
The request through the Gateway returns 500 Internal Server Error (content-length: 0) and the route carries Accepted=True with ResolvedRefs=False, reason InvalidKind, message InferencePool is not enabled | ENABLE_GATEWAY_API_INFERENCE_EXTENSION is false in istiod (the pool then has no condition and the istiod log does not mention the extension) | Reread the variable in the istiod Deployment, set it to true, wait for the redeployment, then reread the route's ResolvedRefs condition |
| The route or the pool is refused | The manifest uses fields from another version of the extension than the installed CRD (the lab installs v1.5.0, the Istio 1.32 documentation v1.0.1) | Record the version of the manifests applied and the inference.networking.k8s.io/bundle-version annotation, compare them with the example's version, then reinstall the CRDs accordingly |
The selecteur Deployment is never ready | The picker waits for an InferencePool named pool-modele that does not exist in inference | Create the pool, then reread kubectl logs deploy/selecteur -n inference |
| The Gateway stays not programmed | Istio's LoadBalancer Service waits for a missing load balancer | Add the networking.istio.io/service-type: ClusterIP annotation |
| The saturated replica receives its share of requests (8 out of 30 behind a Service) | The backendRef targets an ordinary Service, with no InferencePool group or kind | Set group: inference.networking.k8s.io and kind: InferencePool in backendRefs, then look for x-went-into-resp-headers in a response |
The responses carry x-inference-pod but the distribution stays blind | The header comes from the simulator, it is present even without a picker | Count the saturated replica's requests, and read x-went-into-resp-headers and transfer-encoding: chunked |
| The pool does not group the three replicas | selector is too narrow and leaves a model Pod out | Compare selector with the labels read by kubectl get pods -n inference --show-labels |
| The distribution concentrates on a single replica | The requests send the same text, which the picker's prefix scorer favors | Change the text on every request during the measurement |
Hands-on practice
The lab replays the lesson on the kubeadm cluster where Istio 1.32 runs in ambient mode with the extension enabled. You create the InferencePool that groups the three replicas of the simulated model and designates the endpoint picker, a Gateway of class istio and an HTTPRoute whose backend is the pool.
The validation reads the pool, checks that its selector takes exactly the three replicas, that the picker is ready, that the Gateway is programmed and that the route to the pool is accepted. It then sends thirty completion requests. A response counts as served when its code is 200 and the x-inference-pod header names one of the three replicas. At least 27 served responses are required and at most 3 for the saturated replica, or 10% of the 30 requests. With the pool's distribution (30 served, 0 for the saturated one), the test passes. With that of an ordinary Service (30 served, 8 for the saturated one), it fails on the second threshold.
Key takeaways
- A Service reads neither the queue nor the KV cache: a saturated replica keeps receiving requests.
- An
InferencePoolgroups the model's Pods and designates, throughendpointPickerRef, the picker that chooses the replica request by request. - The
HTTPRoutetargets the pool withgroup: inference.networking.k8s.ioandkind: InferencePool, not a Service. - With
ENABLE_GATEWAY_API_INFERENCE_EXTENSIONset tofalsein pilot, the route staysAccepted=TruebutResolvedRefs=False(InvalidKind,InferencePool is not enabled), and the Gateway answers500. - The lab installs v1.5.0 of the extension, whereas the Istio 1.32 documentation installs v1.0.1: compare the version of your manifests with that of an example found online before reusing it.
- The pool must contain all the replicas, the saturated one included: the picker only avoids, request by request, the replicas it sees.
- The
x-inference-podheader comes from the simulator, even without a picker: the proof is the distribution, 0 requests for the saturated replica behind the pool against 8 out of 30 behind an ordinary Service. The picker's own trace isx-went-into-resp-headers: true, with a response intransfer-encoding: chunked. - The distribution is measured on requests whose text changes.
Knowledge check
Eight prediction and diagnosis questions: the distribution by a Service, the role of the endpoint picker, Istio's variable, the pool's content, the text that changes in the measurement, a picker that is never ready, a pool's backendRef and reading the distribution.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Serve a Gateway and filter at L7 with Cilium
A new full quiz with random questions
Work again only on the questions you missed