In the Gateway API Inference Extension edition, I explained why a normal Gateway is not enough for LLM traffic. You also saw how the EPP, InferencePool, and AgentGatewayPolicy work together to fix it.
Now, let's put those concepts into a real Kubernetes cluster.
In this edition, we will deploy an LLM with three replicas. Then we will set up a Gateway that picks the best replica for each request.
Along the way, you'll see where each concept from the last edition fits into the real setup.
💡 Note: Running a real LLM needs GPUs, and GPUs are expensive.
But in this setup, we use a simulator LLM that behaves like a vLLM model server. However, it doesn't give real answers. It returns random, predefined responses. That's enough to test the routing, and it can run without GPUs.
To follow along, you need the following:
A Kubernetes cluster that can create a LoadBalancer
kubectl, Helm, and jq installed on your machine
We will install components from four different projects. To keep their versions in sync, set these environment variables first.
export GATEWAY_API_VERSION=v1.7.0
export IGW_VERSION=v1.6.2
export AGW_CHART_VERSION=v1.8.0
export ROUTER_CHART_VERSION=v1.0.0What We Are Going to Set Up
The image below gives you an overview of the setup.

Here, first we deploy the model. Then we add the Gateway in front of it. After that, we add the components that make the Gateway model-aware.
Let's start with the model.
Deploy a Test LLM
We will keep the model in its own namespace. So first, create the llm-serving namespace.
kubectl create namespace llm-servingNow, deploy the simulator LLM using the manifest from the llm-d project.
kubectl apply -n llm-serving \
-f https://raw.githubusercontent.com/llm-d/llm-d-router/refs/tags/$ROUTER_CHART_VERSION/config/manifests/vllm/sim-deployment.yamlThis creates a Deployment named vllm-qwen3-32b with three replicas. Use the following command to check that the Pods are running.
$ kubectl get po -n llm-serving
NAME READY STATUS RESTARTS AGE
vllm-qwen3-32b-7dc98b85fc-7p2lt 1/1 Running 0 22s
vllm-qwen3-32b-7dc98b85fc-crhs7 1/1 Running 0 22s
vllm-qwen3-32b-7dc98b85fc-ttwvx 1/1 Running 0 22sThese three Pods are the replicas our Gateway will choose from.
Right now, nothing in the cluster can do model-aware traffic routing to them. To make that possible, Kubernetes first needs to know about the Gateway and InferencePool resources.
Install the Gateway API and Inference Extension CRDs
The Inference Extension is an add-on on top of the Gateway API. So we need CRDs from both projects. First, install the Inference Extension CRD. This adds the InferencePool resource to the cluster.
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api-inference-extension/releases/download/$IGW_VERSION/manifests.yamlNext, install the Gateway API CRDs. These add resources like Gateway and HTTPRoute.
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$GATEWAY_API_VERSION/standard-install.yamlNow, verify that both sets of CRDs are installed.
kubectl get crds | grep -E 'inference.networking.k8s.io|gateway.networking.k8s.io'In the output, you should see inferencepools, gateways, and httproutes, along with the other Gateway API CRDs.
Now, we need a controller that watches these resources and acts on them.
Install the AgentGateway Controller
For this setup, we use AgentGateway as the Gateway controller. As we saw in the last edition, it can read the model name from the request body without a separate Body-Based Router Pod.
AgentGateway comes as two Helm charts. The first chart installs its CRDs.
helm install --create-namespace \
--namespace agentgateway-system \
--version ${AGW_CHART_VERSION} \
agentgateway-crds oci://cr.agentgateway.dev/charts/agentgateway-crdsThe second chart installs the controller.
helm install \
--namespace agentgateway-system \
--version ${AGW_CHART_VERSION} \
--set inferenceExtension.enabled=true \
agentgateway oci://cr.agentgateway.dev/charts/agentgatewayThe inferenceExtension.enabled=true setting turns on InferencePool support in AgentGateway. Without it, the Gateway can't send traffic to an InferencePool.
Once the install completes, check that the controller Pod is running.
$ kubectl get pods -n agentgateway-system
NAME READY STATUS RESTARTS AGE
agentgateway-695c88c6f4-lx7p9 1/1 Running 0 8sThe controller is now running. Next, let’s create a Gateway.
Create the Inference Gateway
When we create a Gateway resource, the AgentGateway controller sees it and deploys a proxy Pod. This proxy Pod is our Inference Gateway and it receives all user requests.
Let's keep the Gateway in its own namespace.
kubectl create namespace inference-gatewayNow, create the Gateway resource.
kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: inference-gateway
namespace: inference-gateway
spec:
gatewayClassName: agentgateway
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Selector
selector:
matchLabels:
gateway-access: allowed
EOFThis Gateway uses the agentgateway class and listens for HTTP traffic on port 80.
Also, look at the allowedRoutes block. It allows routes only from namespaces that have the label gateway-access: allowed. This stops routes in other namespaces from attaching to this Gateway.
Our model runs in the llm-serving namespace. So let's add that label to it.
kubectl label namespace llm-serving gateway-access=allowedNext, check the Gateway status.
$ kubectl get gateway inference-gateway -n inference-gateway
NAME CLASS ADDRESS PROGRAMMED AGE
inference-gateway agentgateway 165.245.201.13 True 59sNow, you can see the proxy Pod that the controller created.
$ kubectl get pods -n inference-gateway
NAME READY STATUS RESTARTS AGE
inference-gateway-7574c4bbfc-j5r75 1/1 Running 0 22sAt this point, the Gateway can receive traffic. However, it doesn't know about our model Pods yet. Also, it has no way to pick the best Pod.
This is where the InferencePool and the Endpoint Picker come in.
Create the InferencePool and Endpoint Picker
As you saw in the last edition, the InferencePool groups the model Pods. The Endpoint Picker (EPP) collects their metrics and picks the best Pod for each request.
Fortunately, we don't have to create them one by one. The llm-d router Helm chart creates both. We only need to give it a few values.
So first, create a values file.
cat <<EOF > model.yaml
router:
modelServers:
matchLabels:
app: vllm-qwen3-32b
epp:
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 512Mi
provider:
name: none
httpRoute:
create: false
EOFNow, install the chart in the same namespace as the model.
helm install vllm-qwen3-32b \
oci://ghcr.io/llm-d/charts/llm-d-router-gateway \
--namespace llm-serving \
--version ${ROUTER_CHART_VERSION} \
-f model.yamlOnce the install completes, check the InferencePool.
$ kubectl get inferencepool -n llm-serving
NAME AGE
vllm-qwen3-32b 15sThen list the Pods again.
$ kubectl get po -n llm-serving
NAME READY STATUS RESTARTS AGE
vllm-qwen3-32b-7dc98b85fc-7p2lt 1/1 Running 0 10m
vllm-qwen3-32b-7dc98b85fc-crhs7 1/1 Running 0 10m
vllm-qwen3-32b-7dc98b85fc-ttwvx 1/1 Running 0 10m
vllm-qwen3-32b-epp-68d6cf56c-clqmc 1/1 Running 0 50sYou can see a new vllm-qwen3-32b-epp Pod next to the three model Pods. This is the EPP. From now on, it keeps collecting metrics from the model Pods.
But the Gateway still doesn't know which requests should go to this pool. That's the job of the HTTPRoute.
Route Requests to the InferencePool
In a normal setup, an HTTPRoute sends traffic to a Kubernetes Service. Here, we point it to the InferencePool instead.
Run the following command to create the HTTPRoute.
cat <<EOF | kubectl apply -f -
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: vllm-qwen3-32b
namespace: llm-serving
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: inference-gateway
namespace: inference-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
headers:
- name: X-Gateway-Base-Model-Name
type: Exact
value: Qwen/Qwen3-32B
backendRefs:
- group: inference.networking.k8s.io
kind: InferencePool
name: vllm-qwen3-32b
EOFThis HTTPRoute attaches to our inference-gateway and looks for requests with the header X-Gateway-Base-Model-Name: Qwen/Qwen3-32B. When a request matches, it sends it to the vllm-qwen3-32b InferencePool.
Use the following command to verify that the route is created.
$ kubectl get httproute -n llm-serving
NAME HOSTNAMES AGE
vllm-qwen3-32b 50sBut there is a catch here. The client never sends the X-Gateway-Base-Model-Name header. It only sends the model name inside the JSON body, like this:
{ "model": "Qwen/Qwen3-32B", "prompt": "Hello" }And as we saw in the last edition, an HTTPRoute can't read the request body. So without a complete header, no request would match this route.
This is where the AgentgatewayPolicy helps.
Set the Model Header with AgentgatewayPolicy
AgentgatewayPolicy reads the model name from the request body and adds it as a header. Then the HTTPRoute can match it.
Run the following command to create the policy.
kubectl apply -f - <<EOF
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: inference-model-routing
namespace: inference-gateway
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: inference-gateway
traffic:
phase: PreRouting
transformation:
request:
set:
- name: X-Gateway-Base-Model-Name
value: |
{
"Qwen/Qwen3-32B": "Qwen/Qwen3-32B"
}[string(json(request.body).model)]
EOFThis attaches the policy to our Inference Gateway. So it applies to every request that reaches the Gateway.
The value expression reads the model field from the JSON body. If the model is Qwen/Qwen3-32B, it sets the X-Gateway-Base-Model-Name header to that value.
Now everything is set. Let's send a request and see it working.
Test the Setup
We will send a request to the Gateway's LoadBalancer endpoint, just like a real client would.
First, get the Gateway's external IP and save it in a variable.
IP=$(kubectl get gateway inference-gateway -n inference-gateway \
-o jsonpath='{.status.addresses[0].value}')Then send a request to the /v1/completions endpoint.
curl -s ${IP}:80/v1/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "Qwen/Qwen3-32B",
"prompt": "Hello",
"max_tokens": 50
}' | jq -r '.choices[0].text'Because it's a simulator, you will get a random reply like this:
I am fine, how are you today?The reply doesn't answer the question. However, it proves that the whole flow works.
Here's what happened behind the scenes. The Data Plane uses the AgentgatewayPolicy to read Qwen/Qwen3-32B from the body and set the header.
The HTTPRoute matched that header and sent the request to the InferencePool. Then the EPP checked the live metrics and picked one of the three model Pods to serve it.
Clean Up
If you no longer need the setup, remove the components in the reverse order of how we created them.
Run the following commands one by one to clean up.
$ helm uninstall vllm-qwen3-32b -n llm-serving
$ helm uninstall agentgateway -n agentgateway-system
$ helm uninstall agentgateway-crds -n agentgateway-system
$ kubectl delete -f https://github.com/kubernetes-sigs/gateway-api-inference-extension/releases/download/${IGW_VERSION}/manifests.yaml
$ kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_VERSION}/standard-install.yaml
$ kubectl delete ns llm-serving inference-gateway agentgateway-systemSee you in the next edition.
Thanks for reading.

