Deploy with DGD
Author a DynamoGraphDeployment spec step by step — choose a model and backend, size parallelism for your hardware, then apply it and send requests.
A DynamoGraphDeployment (DGD) is the Kubernetes Custom Resource (CRD) that describes how to deploy a model with Dynamo. You write the spec, kubectl apply it, and the Dynamo operator reconciles it into the running pods, services, and scheduling resources that serve your model. One DGD describes one inference graph: a Frontend plus one or more workers.
This guide walks through authoring that spec end to end: choose a model, pick a backend, choose aggregated or disaggregated serving, size the topology and parallelism for your hardware, then apply the deployment and send it a request. Each step fills in more of a single DGD spec. Environment-specific values — namespace, runtime image, HuggingFace token — stay in shell variables and are filled into the spec at apply time with envsubst, so the same YAML file moves between clusters unchanged.
The examples use the nvidia.com/v1beta1 API: spec.components is a list, and each component carries a standard Kubernetes podTemplate. (The older nvidia.com/v1alpha1 API used a spec.services map with extraPodSpec; the operator still serves it and converts between the two.)
Prerequisites
Before authoring a DGD, make sure you have:
- A Kubernetes cluster with the Dynamo Platform installed. See the Installation Guide.
kubectlaccess to that cluster and a target namespace.- A HuggingFace token for gated or rate-limited models (you create the Secret in step 1).
- New to Dynamo on Kubernetes? Run one model end to end with the Kubernetes Quickstart first, then come back here to author your own spec.
For the concepts behind the CRDs and the operator, see the Model Deployment and the API Reference.
How a DGD is structured
Every DGD has the same top-level shape. spec.components is a list, where each entry is one Dynamo component with a stable name and a type:
type: frontendis the HTTP entry point — see Frontend.type: workerruns the inference engine (vLLM, SGLang, or TensorRT-LLM).- Per-component fields you will use most:
replicas,multinode,sharedMemorySize, andpodTemplate— a standard Kubernetes PodTemplateSpec. The operator injects its defaults into the container namedmaininsidepodTemplate.spec.containers, where you set theimage, thecommand/argsthat launch the engine,resources(CPU/memory/GPU),envFrom,env, andvolumeMounts.
Environment variable order affects references and overrides. Review the environment variable order before setting DGD-level or component environment variables.
For every backend, a component’s name is its stable identifier within the DGD. The operator
uses that name to derive Kubernetes resource names and sets it on the
nvidia.com/dynamo-component label. Keep the name consistent anywhere commands, selectors, scaling
resources, or overrides refer to that component; renaming it changes those references.
The steps below fill in these fields, building one spec from a model to a running deployment.
Choose your model
Pick the model you want to serve from HuggingFace. This guide uses Qwen3-32B as the running example; substitute your own anywhere you see it.
A few values change per environment — the target namespace, the runtime image, and your HuggingFace token. Rather than hard-code them, keep them in shell variables and fill them into the spec at apply time with envsubst (from the gettext package). Export the two you know now — you pick the image in the next step:
Gated or rate-limited models need the token as a Secret in your namespace. Create it once from $HF_TOKEN:
Start the spec with a Frontend and one worker. The ${NAMESPACE} and ${RUNTIME_IMAGE} placeholders are expanded by envsubst when you apply (see the Apply step); the worker pulls the token from the Secret via envFrom, and the model name is passed to the engine as an argument. The worker’s launch command is backend-specific — this guide defaults to vLLM; select your backend and the choice syncs across every code block on this page (you set the matching image in the next step):
vLLM
SGLang
TensorRT-LLM
Substitute Qwen/Qwen3-32B with your model, hf-token-secret with your Secret name if you changed it. Keeping the namespace, image, and token in the environment means the same YAML file works across clusters — you change the exports, not the spec.
Large model? By default every worker pod downloads the weights from HuggingFace on startup — slow for big models and prone to rate limits across many replicas. Cache the weights once on a shared volume and mount them into each worker. See the Model Storage Overview.
Choose your backend
The worker in the previous step runs vLLM. Dynamo also supports SGLang and TensorRT-LLM, and the backend you picked there already synced every code block on this page. The backend sets three things: the runtime image, the launch module (dynamo.vllm / dynamo.sglang / dynamo.trtllm), and how you pass the model and parallelism. Export the matching image so envsubst fills the ${RUNTIME_IMAGE} placeholder on both the Frontend and the worker:
vLLM
SGLang
TensorRT-LLM
The launch module and the way each engine takes the model differ, which is why the worker block changed when you switched tabs above:
vLLM and SGLang take tensor/pipeline/data parallelism as CLI flags (covered in the topology step). TensorRT-LLM is the exception: it reads all parallelism from the engine-config YAML referenced by --extra-engine-args, not from worker flags.
Check the model works on your hardware and backend before you deploy. Not every model, GPU, and backend combination is valid — a quantization can be unsupported on your GPU architecture (for example, FP8 needs Hopper/Ada or newer; some FP4/NVFP4 paths need Blackwell), or an engine may not yet implement a model’s architecture. Confirm against the backend’s supported-models list (vLLM, SGLang, TensorRT-LLM) and, for sizing, the AIConfigurator support matrix.
You normally do not need to set the top-level spec.backendFramework field — the operator infers the backend from the worker command. Set it explicitly (vllm, sglang, or trtllm) only when a feature needs the framework known up front, such as GMS failover, or when the operator cannot infer it from the worker command, which includes every native sidecar engine launch.
For per-backend setup and tuning, see vLLM, SGLang, and TensorRT-LLM.
Private registry? The operator auto-discovers and injects image pull secrets by matching Docker config Secrets in the namespace against your image’s registry host, so private registries usually work with no extra config. To take manual control for a component, set the nvidia.com/disable-image-pull-secret-discovery: "true" annotation on it and list your own imagePullSecrets under podTemplate.spec.
Choose aggregated or disaggregated serving
Before sizing hardware, decide how prefill (prompt processing) and decode (token generation) are placed. Both patterns work with the same DGD spec — you are choosing how many worker roles it has.
- Aggregated — the single worker you have been building does both phases. Simplest to deploy and debug; a good default for smaller models and uniform traffic.
- Disaggregated — separate prefill and decode worker pools, each sized, scaled, and parallelized independently, with the KV cache transferred between them over the network. Reach for it when prefill and decode have different bottlenecks — long prompts saturating prefill while decode sits idle, or high concurrency saturating decode.
If you are staying aggregated, keep the single worker and continue to the next step. To go disaggregated, replace the one worker with two, tagged by role. The tabs below use vLLM as a concrete example to highlight the structural difference — one worker versus a prefill/decode pair; SGLang and TensorRT-LLM follow the same pattern with their own flags:
Aggregated (1 worker)
Disaggregated (prefill + decode)
In the disaggregated spec, type: prefill and type: decode tag the roles, the KV cache moves over NIXL (--kv-transfer-config), and sharedMemorySize is raised for the transfer. When you disaggregate, the next step’s sizing applies to prefill and decode separately — you pick TP/PP for each role.
The fastest way to start is to copy a ready-to-apply Kubernetes template rather than type the spec from scratch. Choose the vLLM, SGLang, or TensorRT-LLM templates in the Recipes tab, then adapt the model, image, and parallelism to your case.
For disaggregation-specific configuration — RDMA resources, UCX environment variables, and prefill/decode scaling — see Disaggregated Serving.
Disaggregated serving moves KV cache between workers over the network. For acceptable performance the cluster needs RDMA — see RDMA Setup. Without it, transfers fall back to TCP with severe latency penalties.
Determine topology and parallelism
Now decide how many GPUs each worker needs and how to split the model across them. (If you disaggregated in the previous step, answer this once for the prefill worker and once for the decode worker — they size independently.)
Will it fit? A rough lower bound for the weights is parameters × bytes-per-parameter: 2 bytes for BF16/FP16, 1 for FP8. Qwen3-32B in BF16 is ~64 GB of weights, so it needs at least two 40 GB GPUs or one 80 GB GPU — and that is before the KV cache, which grows with context length and concurrency. Leave headroom.
The parallelism knobs. A worker’s total GPUs equals the product of its parallel sizes; when it spans machines, that product also equals multinode.nodeCount × per-node GPUs. Five knobs do different jobs:
- Tensor parallelism (TP) splits every layer’s weight matrices across GPUs so one model copy spans them, cutting memory per GPU. The split is communication-heavy (an all-reduce every layer), so TP wants fast intra-node interconnect (NVLink) — keep it within a node.
- Pipeline parallelism (PP) splits the model into sequential stages — contiguous blocks of layers, one block per GPU or node. It also cuts memory per GPU, but only passes activations at stage boundaries, so it tolerates slower links and is how you span across nodes.
- Data parallelism (DP) / replicas runs multiple independent model copies for throughput. It does not help a model fit — each copy still needs enough GPUs to hold the model. Scale whole pods with
replicas, or use the engine’s own--data-parallel-size(common with MoE attention). - Expert parallelism (EP) applies to Mixture-of-Experts models only: it spreads a layer’s experts across GPUs so no single GPU holds them all.
multinode.nodeCountis infrastructure, not a model split: it tells the operator how many physical nodes one worker spans. You set it when TP×PP exceeds the GPUs on a single node.
The exact flag differs per backend. vLLM and SGLang take them as CLI args on the worker; TensorRT-LLM reads them from the engine-config YAML instead:
How to choose. Work from where the model fits:
- Fits on one GPU — no parallelism needed. Leave TP/PP/DP at 1, request one GPU, and skip to the Apply step. Add replicas later only for throughput.
- Doesn’t fit on one GPU, fits on one node — raise TP to the number of GPUs the weights (plus KV cache headroom) require, and set the worker’s
nvidia.com/gpulimit to match. TP keeps one model copy on the fast intra-node fabric. - Doesn’t fit on one node — combine PP with
multinode.nodeCountso contiguous layer blocks land on separate nodes, typically with TP within each node. Total GPUs = TP × PP =nodeCount × per-node GPUs. - Need more throughput — the model already fits; add replicas (or
--data-parallel-size) to run more copies. This scales requests-per-second, not model size. - Mixture-of-Experts — add EP on top of the above (see the MoE note below).
To pick actual numbers, start from a recipe: if one matches your model, backend, and hardware, copy its TP/PP/DP and adapt. If none fits, use AIConfigurator, which sweeps and ranks TP/PP/DP + replica configs for your model, GPU SKU, and latency target — see Sizing with AIConfigurator.
Worked example. Qwen3-32B in BF16 doesn’t fit on one 80 GB GPU with room for KV cache, but TP-2 does. Set the parallel size on the worker and match the GPU limit — for TensorRT-LLM the size lives in the engine-config YAML instead, so only the GPU limit changes on the worker:
vLLM
SGLang
TensorRT-LLM
TensorRT-LLM sets parallelism in the engine config, not on the CLI. TP, PP, and MoE parallelism are keys in the engine-config YAML referenced by --extra-engine-args — tensor_parallel_size, pipeline_parallel_size, moe_tensor_parallel_size, and moe_expert_parallel_size — not worker flags. Edit them there. Start from a per-model config under examples/backends/trtllm/engine_configs/ (it ships agg.yaml, prefill.yaml, and decode.yaml variants), and keep the worker’s nvidia.com/gpu limit equal to the product of those sizes.
Context length. There is no uniform DGD field for maximum context length — it is an engine flag: --max-model-len (vLLM), --context-length (SGLang), or max_seq_len in the engine config (TensorRT-LLM). Longer context needs more free GPU memory for the KV cache, so it trades off against parallel size and concurrency. Set it when the default does not match your workload, for example --max-model-len 32000.
Mixture-of-Experts. MoE models — DeepSeek-R1, Qwen3-235B, Kimi-K2 — add expert parallelism (EP) on top of the knobs above, and expose it as two sizes: how experts are split (EP) and how the non-expert (attention) weights are split (a tensor-parallel size for the MoE layers). In vLLM, enable EP with --enable-expert-parallel, typically alongside --data-parallel-size for the attention layers. In SGLang, use --ep-size with --enable-dp-attention. In TensorRT-LLM, set both moe_expert_parallel_size and moe_tensor_parallel_size in the engine config. Wide-EP deployments usually pair this with multinode and a fast all-to-all backend (for example VLLM_ALL2ALL_BACKEND=deepep_low_latency). For a worked multinode wide-EP example, see the DeepSeek-R1 recipe.
Multinode. When TP × PP exceeds the GPUs on one node, set multinode.nodeCount on the worker so it spans machines; the operator schedules the pods and wires the engine’s cross-node communication (Ray for vLLM, --dist-init-addr/--nnodes for SGLang, MPI for TensorRT-LLM). This needs Grove or LWS installed. To use different images, resources, placement, or commands for the leader and workers, provide Role-Specific Pod Templates. New multinode components expose provider-independent DYNAMO_RANK and DYNAMO_LEADER_ADDRESS aliases for custom commands. See Multinode Deployments and its Portable Topology Environment Variables section, plus the disagg-multinode.yaml templates under each backend’s deploy/ folder.
Leave room for the KV cache. The weights are only part of GPU memory — the KV cache grows with context length and concurrency, and if it has no room the worker OOMs at load or under traffic. Each engine caps the fraction of GPU memory it will use: --gpu-memory-utilization (vLLM, default 0.90), --mem-fraction-static (SGLang), or free_gpu_memory_fraction in the engine config (TensorRT-LLM). If you hit OOM, lower the fraction, add a GPU (raise TP), or reduce max context length.
Apply the deployment and check status
You have exported NAMESPACE and RUNTIME_IMAGE (and created the token Secret). Expand the placeholders and validate the spec with a server-side dry run, then apply it — pipe the file through envsubst both times:
envsubst only substitutes ${VAR} tokens. Confirm the exports are set (echo ${NAMESPACE} ${RUNTIME_IMAGE}) before applying, or the placeholders expand to empty strings. To see the fully rendered spec first, run envsubst < qwen3-32b-agg.yaml | less.
The DGD is the live serving resource. It becomes ready once the Frontend and workers are up — the Ready condition reports True. Watch it reconcile:
Or block until it is ready:
If it stalls, kubectl describe dynamographdeployment <name> -n ${NAMESPACE} and the operator events surface the cause. Common rejections: a multinode component with neither Grove nor LWS installed, an nvidia.com/gpu limit that does not equal tensor-parallel × pipeline-parallel size, or a missing envFrom Secret.
Send a request
The operator creates a ClusterIP Service named <name>-frontend on port 8000. Port-forward it and send requests to the OpenAI-compatible API:
List the served models:
Send a chat completion — the model field must match the model you deployed:
For a stable external address instead of port-forward, see Expose the Frontend.
Put it all together: Qwen3-32B
The following spec assembles the steps above into one aggregated Qwen3-32B deployment, adapted from the agg-round-robin recipe. It reflects the backend you selected earlier. Comments mark the values you substitute for your model, hardware, and scale:
Environment variable order
For DGDs with operator origin 1.8.0 or later, environment precedence is operator defaults,
DGD spec.env, then the selected component or role PodTemplate’s container env.
A more-specific definition replaces the entire general definition, including valueFrom;
cross-layer overrides do not produce duplicate names. Operator-owned topology, GMS, and
per-engine failover bindings retain their generated values.
For snapshot-less intra-pod vLLM failover, the operator assigns
VLLM_NIXL_SIDE_CHANNEL_PORT=5600+engineID and DYN_VLLM_KV_EVENT_PORT=20080+engineID,
where engineID is 0 or 1. Do not override these variables. The operator retains its
per-engine assignments so the engines use distinct ports within the Pod.
The operator preserves the relative order of surviving entries within each input list. It topologically orders references between layers, so a DGD-level variable can reference a component-specific override. Independent entries retain their original general-to-specific input order; names are never sorted alphabetically. Cycles or conflicting ordering constraints fail rendering with the variables and source paths in the error.
These entries render as STORAGE, BASE, then MODEL. Kubernetes expands MODEL to
/fast/models/qwen. Graph-generated DCDs retain the general list in their separate spec.env
until the final renderer adds operator defaults.
Within a single list, Kubernetes’ sequential semantics still apply: forward references are not
reordered and remain literal unless an external value is available. $$(NAME) is escaped, and
shell syntax such as $NAME is not a Kubernetes reference. ConfigMap/Secret values, envFrom,
and provider-injected variables remain runtime inputs; the operator does not fetch or expand them
for ordering.
For SGLang’s NIXL exporter-port lookup, the operator replays the final ordered list without changing
the manifest. Earlier known values are substituted once, including Kubernetes dollar escaping;
a later definition does not retroactively change an earlier expansion. Values from valueFrom,
envFrom, or providers such as Grove remain unknown. An unresolved value alone does not cause
rendering to fail. Replay also leaves values unknown if their expansion exceeds its shared
1 MiB output budget. For example, the lookup can resolve
NIXL_TELEMETRY_PROMETHEUS_PORT: "$(BASE_PORT)" when BASE_PORT is known earlier in the final list.
If the base port is unknown, the operator retains existing port declarations; automatic scrape-port
alignment is not guaranteed. A known invalid port still fails rendering.
Use unique names within the DGD’s root spec.env list (spec.envs in v1alpha1), regardless
of origin. For origins 1.8.0 and later, admission rejects duplicates even when an update leaves
the list unchanged. Repair a stored duplicate list before making unrelated updates; the operator
does not silently de-duplicate it. Earlier or missing origins may retain an existing duplicate
list only when the complete ordered list is unchanged. Changing any value, source, position, or
member requires unique names throughout the list. Names are case-sensitive. Same-named entries
in different layers remain valid overrides, as BASE demonstrates above. Root DCD spec.env
also rejects duplicates on create and update for origins 1.8.0 and later, including unchanged
lists; older or missing origins retain their previous validation behavior.
New or changed root entries must not specify both a non-empty value and valueFrom.
For example, this root list is rejected on create or when changed on update, and on every non-terminating update for origins 1.8.0 and later:
Admission enforces this rule without changing the root list’s OpenAPI merge semantics. Kubernetes does not ratchet a change to list type or keys; adding those schema markers would reject unchanged legacy duplicate lists before the webhook could permit them. Container PodTemplate schemas and alpha service-level env conversion remain unchanged.
In v1alpha1, service.envs and extraPodSpec.mainContainer.env are combined during API
conversion. When both lists define the same name, the extra container value replaces the
service value at its original position. Conversion also de-duplicates entries within
extraPodSpec.mainContainer.env, even when service.envs is empty. Only service.envs
retains same-list repeated names through conversion, but admission rejects such repetitions on
create or list changes because generated child resources require unique names. Only earlier or
missing origins can retain an unchanged existing service list with duplicates; origins 1.8.0 and
later reject it. New or changed lists also reject a non-empty value combined with valueFrom.
Keep order-dependent variables with unique names together in
service.envs, and avoid redefining those names in the extra
container list. For direct ordered PodTemplate configuration, use v1beta1 with
podTemplate.spec.containers[*].env.
DGDs created by an operator older than 1.8.0, or without the
nvidia.com/dynamo-operator-origin-version annotation, retain the legacy sorted and de-duplicated
output after an operator upgrade. See the
Dynamo Platform v1.8.0 upgrade notes
for migration guidance.
For origins 1.8.0 and later, changing only environment-list order is a workload change and is propagated to the selected provider. Switching to order-sensitive resource hashing may update top-level bookkeeping annotations, but does not change an otherwise unchanged workload spec.
vLLM
SGLang
TensorRT-LLM
This runs eight TP-2 workers (16 GPUs). To turn it into one of the variations above — disaggregated, multinode, MoE expert-parallel, cached, KV-routed, or offloaded — apply the change from that step or the matching page below.
Before updating a Grove deployment
Grove uses RollingRecreate by default for every DGD. To opt into Coherent, set metadata.annotations["nvidia.com/grove-update-strategy"]: Coherent. New Grove DGDs created by operator 1.6.0 or later default provider-native minAvailable to 1 unless the manifest uses a deprecated component minimum. Existing DGDs retain their persisted legacy minima. Moving those minima to provider overrides preserves their effective values and does not select Coherent.
For deployments that explicitly select Coherent, use Grove v0.1.0-alpha.15 or later with its matching CRDs, which includes the corrective-update recovery fix, and complete these checks before changing worker images or pod templates:
- Review each component’s effective
minAvailableand whether it uses the deprecated field or a provider override. It defines the minimum viable replacement unit under Coherent. For new deployments, start at1unless the application requires a larger unit; the field is immutable after creation. - Review any
providerOverride.value.rollingUpdate.maxUnavailable. It is a ceiling on unavailable replicas, defaults to the effective minimum under Coherent, and must be at least that minimum. - Check how much serving capacity remains while that unit is unavailable. With eight replicas and
minAvailable: 4, the default disruption budget allows four unavailable replicas. A changed component with only one replica can become completely unavailable. - Plan with existing capacity: Grove has no surge support, and replica changes are deferred throughout an active coherent rollout. Do not depend on an HPA or the Planner adding replicas mid-rollout.
- Update compatible worker components together. Dynamo’s shared worker hash can roll all workers when one worker template changes; a frontend participates when its own rendered template changes. Validate latency and throughput under representative traffic before increasing the disruption budget.
See Coherent capacity and disruption for budget semantics and examples. Coherent coordination applies within one PCS and does not guarantee zero downtime.
Recover from a stalled Coherent update
On Grove alpha.14, a corrective update can stall because old replicas are already unavailable. Grove issue #873 is fixed in v0.1.0-alpha.15; upgrade Grove and its matching CRDs together. For an older installation with a stalled update, changing or removing the strategy annotation cannot unblock it: Dynamo waits for the active Grove update to finish before applying a strategy change.
Recreating the DGD stops its workloads and interrupts serving. Plan downtime or move traffic to another deployment before using this reset path.
-
Prepare a replacement manifest, such as
deployment.yaml, with the same DGD name and namespace. Removemetadata.annotations["nvidia.com/grove-update-strategy"]to use RollingRecreate. -
Delete the DGD and wait for its owned resources to be removed. Replace the example name and namespace with those from your manifest:
-
Recreate the deployment from the prepared manifest:
Verify that the components become Ready and inference succeeds before restoring traffic.
For PodCliqueScalingGroup (PCSG) components, deleting stuck member pods does not unblock this failure: Grove refills them at the old revision. For a standalone PodClique, deleting the stuck pod is a proposed workaround that has not been verified on a running cluster; do not rely on it as a confirmed recovery procedure.
Optional next steps
These are independent capabilities you opt into per workload. None are required for a working deployment.
The Planner is not part of the DGD spec. SLA-driven autoscaling with the Planner is configured through a DynamoGraphDeploymentRequest (DGDR) — see Auto Deploy with DGDR. For HPA/KEDA scaling of a DGD service, see the DynamoGraphDeploymentScalingAdapter API. For the full field reference, see the API Reference.