> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read the PD well lit Path Against Our Live Cluster

> Examines real P/D (prefill/decode) Kubernetes manifests versus live cluster, showing split deployments, routing sidecar, EPP scheduling, NIXL KV transfers, and performance benefits for long-context inference.

This lesson inspects the real manifests used by the P/D (prefill/decode) well-lit path and compares them with what our live cluster actually runs. The goal is to show how close the production manifests are to a straightforward, honest deployment — without faking cross-node memory transfers or simulating specialized NICs.

The core idea: prefill and decode stress hardware differently. Prefill performs a big read over long contexts and builds cache state (KV blocks). Decode streams tokens back, incrementally consuming that state. Splitting the phases lets you tune each independently and — on appropriate hardware and topology — can increase tokens-per-second by \~70% for long prompts, mixed traffic, and lockstep expert groups.

We won't fake cross-machine memory transfers. Instead, we'll inspect the real P/D manifests and compare them to what our cluster actually runs — the distance between them is smaller than you might expect.

![A dark-themed slide titled "Read It, Don't Fake It" showing two highlighted cards: a teal "Our Live Cluster — Optimized baseline" card on the left and an outlined "P/D Well-Lit Path — The real manifests" card on the right. A rounded button labeled "Look at what we run" sits below.](https://mintcdn.com/kodekloud-c4ac6d9a/wZG0g2zT9jW-sxn2/images/llm-d-A-Deep-Dive/Serving-Bigger-Models-With-llm-d/Read-the-PD-well-lit-Path-Against-Our-Live-Cluster/read-it-dont-fake-it-cards.jpg?fit=max\&auto=format\&n=wZG0g2zT9jW-sxn2\&q=85\&s=12e1fe63b4519acb1c09f3de75e9c5c8)

## 1) Inspect what the cluster actually runs

Start by listing pods and their labels in the `llm-d` namespace:

```bash theme={null}
kubectl get pods -n llm-d --show-labels
```

In our cluster the model pods all share the same role label:

Example output (trimmed):

```text theme={null}
NAME                                                    READY   STATUS    RESTARTS   AGE
optimized-baseline-cpu-vllm-decode-5c77c88766-4hmpb     1/1     Running   0          5d16h
    llm-d.ai/accelerator-variant=cpu,llm-d.ai/accelerator-vendor=intel,llm-d.ai/guide=optimized-baseline,llm-d.ai/model=Qwen2.5-0.5B-Instruct,llm-d.ai/role=decode,pod-template-hash=5c77c88766
optimized-baseline-cpu-vllm-decode-5c77c88766-drbrd     1/1     Running   0          5d16h
    llm-d.ai/accelerator-variant=cpu,llm-d.ai/accelerator-vendor=intel,llm-d.ai/guide=optimized-baseline,llm-d.ai/model=Qwen2.5-0.5B-Instruct,llm-d.ai/role=decode,pod-template-hash=5c77c88766
optimized-baseline-cpu-vllm-decode-5c77c88766-g7kkb     1/1     Running   0          5d16h
    llm-d.ai/accelerator-variant=cpu,llm-d.ai/accelerator-vendor=intel,llm-d.ai/guide=optimized-baseline,llm-d.ai/model=Qwen2.5-0.5B-Instruct,llm-d.ai/role=decode,pod-template-hash=5c77c88766
quickstart-epp-5f6cbf8c4-tc17q                          2/2     Running   0          17d
    llm-d-router-gateway=quickstart-epp,llm-d.ai/igw-mode=llm-d-router-gateway,pod-template-hash=5f6cbf8c4
```

The `llm-d.ai/role` label is the key switch:

```text theme={null}
llm-d.ai/role:
role=decode
role=decode
role=decode
```

Table: label roles and intent

| Label key | Value | Purpose |
| - | - | - |
| `llm-d.ai/role` | `decode` | Default model pod that handles both prefill and decode in the optimized baseline |
| `llm-d.ai/role` | `prefill` | (When present) dedicated prefill pods that only do the initial heavy read and produce KV blocks |

## 2) How manifests change for P/D split

Adopting the P/D split introduces a second deployment for prefill. The layout (relevant files) looks like:

```text theme={null}
guides/recipes/modelserver/base

single-host/
├── default/
│   └── decode-deployment.yaml
└── pd/
    └── base/
        └── prefill-deployment.yaml
```

Both deployments run the same vLLM binary, but they carry different role labels so the router and EPP (Endpoint Picker Plugin) can treat them differently.

Essential fragments from each deployment:

```yaml theme={null}
# prefill-deployment.yaml (essential fragment)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prefill
  labels:
    llm-d.ai/role: prefill
spec:
  selector:
    matchLabels:
      llm-d.ai/role: prefill
  template:
    metadata:
      labels:
        llm-d.ai/role: prefill
    # ...
```

```yaml theme={null}
# decode-deployment.yaml (essential fragment)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: decode
  labels:
    llm-d.ai/role: decode
spec:
  selector:
    matchLabels:
      llm-d.ai/role: decode
  template:
    metadata:
      labels:
        llm-d.ai/role: decode
    # ...
```

## 3) The decode pod sidecar (routing proxy)

When enabling P/D, a small routing-proxy sidecar is added to decode pods. It acts as the receiving dock for KV blocks that prefill pods produce. The sidecar listens on the pod's external port (8000); vLLM is moved behind it on 8200.

![A slide diagram titled "A Passenger in Every Decode Pod" showing a Decode Pod with a routing-proxy sidecar (labeled "The receiving dock") connected by an arrow to a vLLM component. A patch-sidecar.yaml element is shown as being added by one patch.](https://mintcdn.com/kodekloud-c4ac6d9a/wZG0g2zT9jW-sxn2/images/llm-d-A-Deep-Dive/Serving-Bigger-Models-With-llm-d/Read-the-PD-well-lit-Path-Against-Our-Live-Cluster/decode-pod-routing-proxy-vllm-patch.jpg?fit=max\&auto=format\&n=wZG0g2zT9jW-sxn2\&q=85\&s=42b38ca6bf0b9afe0d42d972a6f616fc)

Sidecar + vLLM snippet (decode deployment):

```yaml theme={null}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: decode
spec:
  template:
    spec:
      containers:
      - name: routing-proxy
        args:
        - --port=8000
        - --vllm-port=8200
        - --kv-connector=nixlv2
        - --zap-log-level=1
        - --secure-proxy=false
        image: REPLACE_ROUTING_SIDECAR_IMAGE
        imagePullPolicy: Always
        ports:
        - containerPort: 8000
          name: sidecar
          protocol: TCP
      - name: modelserver
        # modelserver (vLLM) listens on 8200 when the sidecar is present
        # ...
# ... resources, securityContext
```

## 4) One pool, two roles — how routing binds them

Both prefill and decode deployments join a single inference pool. Note the pool selector matches on a shared `llm-d.ai/guide` label, not `llm-d.ai/role`. That allows the router to treat them as one fleet while roles differentiate scheduling behavior internally.

Router chart fragment:

```yaml theme={null}
router:
  extraServicePorts:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 8081

  epp:
    pluginsConfigFile: "pd-config.yaml"
    pluginsCustomConfig:
      pd-config.yaml: |
        # ... lines omitted
modelServers:
  matchLabels:
    llm-d.ai/guide: "pd-disaggregation"
```

Result: one service endpoint for clients, one pool of model servers, but two internal pod roles for P/D orchestration.

## 5) The Endpoint Picker Plugin (EPP) — scheduling profiles and decider

The EPP config holds the P/D routing logic. It loads plugin-style filters/scorers and defines two scheduling profiles — `prefill` and `decode`. Filters match pod labels (`llm-d.ai/role`) and a decider plugin marks requests that should be split.

EPP plugin excerpt:

```yaml theme={null}
epp:
  pluginsConfigFile: "pd-config.yaml"
  pluginsCustomConfig:
    pd-config.yaml: |
      apiVersion: llm-d.ai/v1alpha1
      kind: EndpointPickerConfig
      plugins:
        - type: disagg-headers-handler
        - type: always-disagg-pd-decider
        - type: disagg-profile-handler
          parameters:
            deciderPluginName: always-disagg-pd-decider
        - type: prefill-filter
        - type: decode-filter
        - type: prefix-cache-scorer
        - type: queue-scorer
        - type: kv-cache-utilization-scorer
        - type: active-request-scorer
```

Scheduling profile snippet (weights used in our cluster):

```yaml theme={null}
schedulingProfiles:
  - name: prefill
    plugins:
      - pluginRef: prefill-filter
      - pluginRef: prefix-cache-scorer
        weight: 3
      - pluginRef: queue-scorer
        weight: 2
      - pluginRef: kv-cache-utilization-scorer
        weight: 2
  - name: decode
    plugins:
      - pluginRef: decode-filter
      - pluginRef: active-request-scorer
        weight: 2
      - pluginRef: prefix-cache-scorer
        weight: 3
```

Table: high-level EPP behavior

| Scheduling profile | Main filter | Key scorers (examples) | Intent |
| - | - | - | - |
| `prefill` | `prefill-filter` | `prefix-cache-scorer` (w:3), `queue-scorer` (w:2), `kv-cache-utilization-scorer` (w:2) | Choose pods that maximize cache locality and KV transfer efficiency for the single-shot prefill read |
| `decode` | `decode-filter` | `active-request-scorer` (w:2), `prefix-cache-scorer` (w:3) | Choose pods that minimize latency for streaming token-by-token decode and use existing cache state |

## 6) Request flow with P/D enabled

Step through a long request:

* Client → Inference gateway.
* Gateway invokes EPP: the decider marks the request for P/D and EPP picks a prefill pod first (based on `prefill` profile).
* Prefill pod reads the prompt, performs the heavy model pass and produces saved work (KV blocks).
* KV blocks are transferred to the chosen decode pod (point-to-point transfer).
* Decode pod — with the routing-proxy sidecar receiving the blocks — resumes from the saved state and streams tokens back to the client.

The transfer uses a connector configured in the vLLM arguments (KV transfer connector) and a chosen block size. Example vLLM args in the prefill deployment:

```yaml theme={null}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prefill
spec:
  replicas: 8
  template:
    spec:
      containers:
      - name: modelserver
        command: ["vllm", "serve"]
        args:
        - "openai/gpt-oss-120b"
        - "--disable-access-log-for-endpoints=/health,/metrics,/v1/models"
        - "--tensor-parallel-size=1"
        - "--block-size=128"
        - "--kv-transfer-config"
        - '{"kv_connector":"NixlConnector", "kv_role":"kv_both"}'
        - "--no-disable-hybrid-kv-cache-manager"
      # ... env, resources, probes, volumes
```

## 7) NIXL — the KV transfer library

What is NIXL? It is an inference transfer library used to accelerate point-to-point KV block transfers in disaggregated LLM deployments. In practice it reduces transfer latency and overhead for large KV caches.

![An infographic titled "What Is NIXL?" describing NIXL (NVIDIA Inference Xfer/Transfer Library) with a logo and three feature badges: Open source, Vendor-agnostic, and Point-to-point. Below that is a schematic showing large KV caches and memory blocks labeled Prefill pod memory and Decode pod memory.](https://mintcdn.com/kodekloud-c4ac6d9a/wZG0g2zT9jW-sxn2/images/llm-d-A-Deep-Dive/Serving-Bigger-Models-With-llm-d/Read-the-PD-well-lit-Path-Against-Our-Live-Cluster/nixl-infographic-opensource-vendoragnostic-kv-memory.jpg?fit=max\&auto=format\&n=wZG0g2zT9jW-sxn2\&q=85\&s=9bfd73143309aa3e8da500ddb25540fb)

Two quick notes:

* Block size (`--block-size=128`) determines KV granularity. Smaller blocks mean more transfers but finer-grained caching; larger blocks reduce per-transfer overhead but may move extra state.
* The connector selection (`NixlConnector`) and `kv_role` determine whether the pod sends, receives, or does both (`kv_both`).

Sitting right beside another old friend: a block size of 128. That block size determines the granularity of KV blocks moved between prefill and decode.

Back on the diagram: the sidecar receives the blocks, and the decode pod picks up exactly where the prefill pod left off, writing the answer token-by-token and streaming it back to the user.

![A diagram titled "The Stream Comes Back" showing request flow from a user through an Inference Gateway to Prefill Pods and Decode Pods (vLLM). A sidecar receives the blocks and the system streams the answer back token-by-token.](https://mintcdn.com/kodekloud-c4ac6d9a/wZG0g2zT9jW-sxn2/images/llm-d-A-Deep-Dive/Serving-Bigger-Models-With-llm-d/Read-the-PD-well-lit-Path-Against-Our-Live-Cluster/vllm-stream-back-inference-gateway-sidecar.jpg?fit=max\&auto=format\&n=wZG0g2zT9jW-sxn2\&q=85\&s=0707f0ddd33b959ce0d485df926d6b36)

## Key takeaways

* The P/D split separates heavy, bursty prefill reads from low-latency decode streams; this allows independent tuning and can greatly increase throughput for long-context workloads.
* You do not need a fundamentally different vLLM binary: the split is implemented by labels, a tiny sidecar, EPP scheduling profiles, and a KV transfer connector.
* We do not simulate cross-node transfers in this lesson; instead we read the real manifests and show the genuine patches and configurations used in the P/D well-lit path.
* If you adopt P/D in production, ensure your network topology and NICs can handle low-latency, high-throughput point-to-point transfers (this is where the split pays off).

## Links and references

* [Kubernetes documentation — Concepts overview](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/)
* vLLM: [vllm project on GitHub](https://github.com/vllm-project/vllm)
* For production-style routing and endpoint picking, consult your router/EPP documentation and plugin references (this example used an Endpoint Picker Plugin configuration).

> [card] [Watch Video](https://learn.kodekloud.com/user/courses/llm-d-a-deep-dive/module/4e52cd5b-6e1d-4d63-af4d-5442e6fa9b81/lesson/d47a2987-79cb-4457-a252-744909f908b6)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.