vllm-2p1d.yaml 9.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Multi-DGD deployment for hierarchical planner example with vLLM workers
# Architecture:
#   DGD 1 (hierarchical): Frontend + GlobalRouter
#   DGD 2 (prefill-pool-0): Local Router + vLLM Prefill Worker (1 GPU)
#   DGD 3 (prefill-pool-1): Local Router + vLLM Prefill Worker (1 GPU)
#   DGD 4 (decode-pool-0): Local Router + vLLM Decode Worker (1 GPU)
#
# IMPORTANT: This file uses ${K8S_NAMESPACE} as a placeholder for the Kubernetes namespace.
# The K8s operator prepends the K8s namespace to the Dynamo namespace.
# For example, if K8S_NAMESPACE="my-namespace" and dynamoNamespace is "prefill-pool-0",
# the actual Dynamo namespace becomes "my-namespace-prefill-pool-0".
#
# vLLM workers register at:
#   - Prefill: <namespace>.prefill.generate
#   - Decode:  <namespace>.backend.generate
#
# USAGE: See README.md for deployment instructions using envsubst.
# =============================================================================
# ConfigMap for global router configuration
# =============================================================================
apiVersion: v1
kind: ConfigMap
metadata:
  name: hierarchical-global-router-config
data:
  global_router_config.json: |
    {
        "num_prefill_pools": 2,
        "num_decode_pools": 1,
        "prefill_pool_dynamo_namespaces": ["${K8S_NAMESPACE}-prefill-pool-0", "${K8S_NAMESPACE}-prefill-pool-1"],
        "decode_pool_dynamo_namespaces": ["${K8S_NAMESPACE}-decode-pool-0"],
        "prefill_pool_selection_strategy": {
            "ttft_min": 10,
            "ttft_max": 1000,
            "ttft_resolution": 2,
            "isl_min": 0,
            "isl_max": 32000,
            "isl_resolution": 2,
            "prefill_pool_mapping": [[0,1],[0,1]]
        },
        "decode_pool_selection_strategy": {
            "itl_min": 10,
            "itl_max": 100,
            "itl_resolution": 2,
            "context_length_min": 0,
            "context_length_max": 32000,
            "context_length_resolution": 2,
            "decode_pool_mapping": [[0,0],[0,0]]
        }
    }
---
# =============================================================================
# DGD 1: Frontend + Global Router (namespace: hierarchical)
# =============================================================================
apiVersion: nvidia.com/v1alpha1
kind: DynamoGraphDeployment
metadata:
  name: hierarchical-frontend
spec:
  envs:
  - name: HF_TOKEN
    valueFrom:
      secretKeyRef:
        key: HF_TOKEN
        name: hf-token-secret
  services:
    Frontend:
      componentType: frontend
      dynamoNamespace: hierarchical
      extraPodSpec:
        mainContainer:
          args:
          - --router-mode
          - round-robin
          - --namespace
          - ${K8S_NAMESPACE}-hierarchical
          command:
          - python
          - -m
          - dynamo.frontend
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
    GlobalRouter:
      componentType: default
      dynamoNamespace: hierarchical
      extraPodSpec:
        mainContainer:
          args:
          - --config
          - /workspace/config/global_router_config.json
          - --model-name
          - Qwen/Qwen3-0.6B
          - --default-ttft-target
          - "100"
          - --default-itl-target
          - "10"
          - --namespace
          - ${K8S_NAMESPACE}-hierarchical
          command:
          - python
          - -m
          - dynamo.global_router
          image: ${VLLM_IMAGE}
          workingDir: /workspace
          volumeMounts:
          - mountPath: /workspace/config
            name: global-router-config
            readOnly: true
        volumes:
        - configMap:
            name: hierarchical-global-router-config
          name: global-router-config
      replicas: 1
---
# =============================================================================
# DGD 2: Prefill Pool 0 - Local Router + vLLM Worker (namespace: prefill-pool-0)
# Actual Dynamo namespace: ${K8S_NAMESPACE}-prefill-pool-0
# vLLM prefill worker registers at: ${K8S_NAMESPACE}-prefill-pool-0.prefill.generate
# =============================================================================
apiVersion: nvidia.com/v1alpha1
kind: DynamoGraphDeployment
metadata:
  name: prefill-pool-0
spec:
  envs:
  - name: HF_TOKEN
    valueFrom:
      secretKeyRef:
        key: HF_TOKEN
        name: hf-token-secret
  services:
    LocalRouter:
      componentType: default
      dynamoNamespace: prefill-pool-0
      extraPodSpec:
        mainContainer:
          args:
          - --endpoint
          - ${K8S_NAMESPACE}-prefill-pool-0.prefill.generate
144
          - --router-block-size
145
          - "16"
146
          - --no-router-track-active-blocks
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
          command:
          - python
          - -m
          - dynamo.router
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
    VllmPrefillWorker:
      componentType: worker
      subComponentType: prefill
      dynamoNamespace: prefill-pool-0
      envFromSecret: hf-token-secret
      extraPodSpec:
        mainContainer:
          args:
          - --model
          - Qwen/Qwen3-0.6B
164
165
          - --disaggregation-mode
          - prefill
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
          - --tensor-parallel-size
          - "1"
          - --gpu-memory-utilization
          - "0.90"
          - --block-size
          - "16"
          command:
          - python3
          - -m
          - dynamo.vllm
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
      resources:
        limits:
          gpu: "1"
        requests:
          gpu: "1"
---
# =============================================================================
# DGD 3: Prefill Pool 1 - Local Router + vLLM Worker (namespace: prefill-pool-1)
# Actual Dynamo namespace: ${K8S_NAMESPACE}-prefill-pool-1
# vLLM prefill worker registers at: ${K8S_NAMESPACE}-prefill-pool-1.prefill.generate
# =============================================================================
apiVersion: nvidia.com/v1alpha1
kind: DynamoGraphDeployment
metadata:
  name: prefill-pool-1
spec:
  envs:
  - name: HF_TOKEN
    valueFrom:
      secretKeyRef:
        key: HF_TOKEN
        name: hf-token-secret
  services:
    LocalRouter:
      componentType: default
      dynamoNamespace: prefill-pool-1
      extraPodSpec:
        mainContainer:
          args:
          - --endpoint
          - ${K8S_NAMESPACE}-prefill-pool-1.prefill.generate
210
          - --router-block-size
211
          - "16"
212
          - --no-router-track-active-blocks
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
          command:
          - python
          - -m
          - dynamo.router
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
    VllmPrefillWorker:
      componentType: worker
      subComponentType: prefill
      dynamoNamespace: prefill-pool-1
      envFromSecret: hf-token-secret
      extraPodSpec:
        mainContainer:
          args:
          - --model
          - Qwen/Qwen3-0.6B
230
231
          - --disaggregation-mode
          - prefill
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
          - --tensor-parallel-size
          - "1"
          - --gpu-memory-utilization
          - "0.90"
          - --block-size
          - "16"
          command:
          - python3
          - -m
          - dynamo.vllm
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
      resources:
        limits:
          gpu: "1"
        requests:
          gpu: "1"
---
# =============================================================================
# DGD 4: Decode Pool 0 - Local Router + vLLM Worker (namespace: decode-pool-0)
# Actual Dynamo namespace: ${K8S_NAMESPACE}-decode-pool-0
# vLLM decode worker registers at: ${K8S_NAMESPACE}-decode-pool-0.backend.generate
# =============================================================================
apiVersion: nvidia.com/v1alpha1
kind: DynamoGraphDeployment
metadata:
  name: decode-pool-0
spec:
  envs:
  - name: HF_TOKEN
    valueFrom:
      secretKeyRef:
        key: HF_TOKEN
        name: hf-token-secret
  services:
    LocalRouter:
      componentType: default
      dynamoNamespace: decode-pool-0
      extraPodSpec:
        mainContainer:
          args:
          - --endpoint
          - ${K8S_NAMESPACE}-decode-pool-0.backend.generate
276
          - --router-block-size
277
          - "16"
278
          - --router-kv-overlap-score-weight
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
          - "0"
          command:
          - python
          - -m
          - dynamo.router
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
    VllmDecodeWorker:
      componentType: worker
      subComponentType: decode
      dynamoNamespace: decode-pool-0
      envFromSecret: hf-token-secret
      extraPodSpec:
        mainContainer:
          args:
          - --model
          - Qwen/Qwen3-0.6B
          - --tensor-parallel-size
          - "1"
          - --gpu-memory-utilization
          - "0.90"
          - --block-size
          - "16"
          command:
          - python3
          - -m
          - dynamo.vllm
          image: ${VLLM_IMAGE}
          workingDir: /workspace
      replicas: 1
      resources:
        limits:
          gpu: "1"
        requests:
          gpu: "1"