Most “LLM on vSphere” requests arrive as a sentence like “we need a GPU VM for Llama”, and most of the pain that follows comes from three things nobody wrote down: which GPU sharing model the VM is on, how much GPU memory the model really needs once the KV cache is counted, and the handful of host and VM settings that stop a large-BAR GPU from powering on at all. This guide covers all three for NVIDIA GPUs on vSphere 8 and VCF 9, then serves a model with vLLM (or NVIDIA NIM) and wires its telemetry through an OpenTelemetry Collector into Grafana, including the part NVIDIA’s own docs are blunt about: DCGM is not supported inside vGPU guests.

Level: intermediate to advanced  ·  Stack: vSphere 8 or VCF 9, NVIDIA AI Enterprise Infra (vGPU for Compute), Ubuntu guest, vLLM 0.34 or NIM, OpenTelemetry Collector 0.166, Prometheus or Mimir, Tempo, Grafana  ·  Build time: half a day including one host maintenance window


Contents

  1. What we are building
  2. Three ways to give a VM a GPU
  3. vGPU profile names, decoded
  4. Prepare the ESXi host
  5. Template: GPU VM checklist
  6. Guest driver and licensing
  7. Sizing GPU memory for a model
  8. Serving the model
  9. Observability with OpenTelemetry
  10. End-to-end workflow
  11. Troubleshooting
  12. Where VMware Private AI Foundation with NVIDIA fits
  13. What’s next

01. What we are building

One ESXi host with a data center GPU (the examples use an H100 PCIe 80 GB), one Ubuntu VM with a C-series vGPU, a vLLM server exposing an OpenAI-compatible API, and a collector in the same VM that ships serving metrics and traces to your backends. The same host and VM preparation applies if you later run the model on a VKS cluster with the NVIDIA GPU Operator; the Kubernetes variant is covered in section 08.

Inference stack (bottom up) Telemetry Clients apps, agents, curl: OpenAI-compatible API on :8000 with an API key Serving engine: vLLM or NVIDIA NIM weights + KV cache in GPU memory · /metrics (vLLM), /v1/metrics (NIM) Container runtime + NVIDIA Container Toolkit or a VKS node pool with the NVIDIA GPU Operator Linux guest: vGPU for Compute guest driver nvidia-gridd licensed from NLS (CLS or DLS) · nvidia-smi sees e.g. H100-40C VM: EFI, all memory reserved, 64-bit MMIO PCI device = C-series vGPU profile (time-sliced or MIG-backed) ESXi: NVIDIA Virtual GPU Manager + GPU mgmt daemon GPU graphics type Shared Direct · MIG mode set here · scheduler policy Server and GPU (example: H100 PCIe 80 GB) BIOS: SR-IOV on, VT-d/IOMMU on, MMIO above 4 GB on Passthrough skips the vGPU Manager layer: the VM owns the device and runs the data center driver. Sources in the VM vLLM /metrics (scrape) vLLM traces (OTLP gRPC) dcgm-exporter :9400 supported on passthrough only OTel Collector (contrib) prometheus + otlp + host_metrics receivers, resource attributes Prometheus or Mimir Tempo traces Grafana KV cache, queue, TTFT, tokens/s Host-side view nvidia-smi vgpu on ESXi vGPU Profile Utilization (VCF 9)
The inference stack from server BIOS to API, and the telemetry path beside it.

Each layer has one job and one way to fail:

  • Server and GPU: SR-IOV, VT-d/IOMMU and MMIO above 4 GB must be enabled in the BIOS. NVIDIA lists these as prerequisites for Ampere and later GPUs.
  • ESXi: the NVIDIA Virtual GPU Manager (a VIB-based component) turns one physical GPU into many vGPUs. Without it, the only option is passthrough.
  • VM: must boot EFI, reserve all memory and have enough 64-bit MMIO space for the GPU’s large BAR. Get this wrong and the VM does not power on.
  • Guest: runs the vGPU for Compute guest driver, which must match the host driver branch and must hold a license from the NVIDIA License System, or performance is throttled after a grace period.
  • Serving engine: loads weights into GPU memory and fills the rest with KV cache. Its own metrics are the best signal you have of whether the GPU is the bottleneck.

02. Three ways to give a VM a GPU

Passthrough DirectPath I/O, one VM per GPU Time-sliced vGPU example: 4 x H100-20C MIG-backed vGPU example: 3g + 2g + 1g + 1g VM A VM A VM B VM C VM D VM A VM B VM C VM D Physical GPU, 80 GB All SMs: VM A All 80 GB memory: VM A Physical GPU, 80 GB All SMs, shared in time slices A, B, C, D take turns 20 GB 20 GB 20 GB 20 GB Physical GPU, 80 GB, MIG mode on 3g.40gb A: 3-40C 2g.20gb B: 2-20C 1g C 1g D Good at Full GPU, native data center driver, no vGPU license needed DCGM metrics supported Costs No vMotion; GPU idles when the VM does; 64-bit MMIO sizing is on you Good at Density on any supported GPU; fixed memory per VM; vMotion and suspend-resume Costs Compute contention between VMs; latency varies with neighbours; scheduler policy is per GPU Good at Hardware isolation: own SMs, cache and memory bandwidth; predictable latency per tenant Costs Fixed slice shapes only; MIG mode set on the host; migration needs a matching MIG layout Profile names follow NVIDIA’s vGPU for Compute tables for H100 PCIe 80 GB. vSphere shows them lowercase with an nvidia_ prefix.
Passthrough, time-sliced vGPU and MIG-backed vGPU on the same 80 GB GPU.
Passthrough (DirectPath I/O)Time-sliced vGPUMIG-backed vGPU
————
What the VM getsThe whole physical deviceA fixed slice of framebuffer; compute shared in time slices with other vGPUs on the GPUA hardware GPU instance: its own SMs, cache, memory and bandwidth
Host softwareNone from NVIDIA; the guest runs the data center driverNVIDIA Virtual GPU ManagerNVIDIA Virtual GPU Manager, MIG mode enabled on the GPU
LicensingNo NVIDIA AI Enterprise license needed for the GPU itselfNVIDIA AI Enterprise, enforced per vGPU in softwareSame as time-sliced
vMotionNoYes, once enabled in vCenterYes, target host needs a matching MIG layout
IsolationTotalMemory and fault isolation; compute is contendedMemory, fault and compute isolation
DCGM metrics in the guestSupportedNot supportedNot supported
Good forOne large model per GPU, multi-GPU tensor parallel, benchmarkingDense dev/test, light inference, mixed workloadsMulti-tenant inference with latency SLAs

The isolation row is the one to argue about. On a time-sliced GPU, four VMs each own 20 GB of memory, but they take turns on the same SMs. NVIDIA’s default scheduler (Best Effort) lets an idle VM give its turns to busy ones, which is great for utilization and bad for predictable latency. Equal Share and Fixed Share trade utilization for predictability, and the policy is set on the host per physical GPU (or per GPU instance for time-sliced MIG-backed vGPUs), not per VM. MIG removes the argument by giving each tenant dedicated hardware, at the price of fixed slice shapes.

Practical default. For production inference with more than one team on a GPU, use MIG-backed vGPUs. For a single large model per GPU, use the full-framebuffer time-sliced profile (for example H100-80C) rather than passthrough unless you need passthrough-only features: you keep vMotion and suspend-resume and lose very little.

03. vGPU profile names, decoded

NVIDIA’s vGPU for Compute profiles end in C and are licensed through NVIDIA AI Enterprise. The vWS/vPC product family that ships the Q, B and A profiles does not offer C-series types on vSphere, so if C-series profiles are missing from the Device Selection list, check which Virtual GPU Manager is installed first.

ProfileModeFramebufferMax per H100 PCIe 80 GBReads as
—————
H100-80CTime-sliced80 GB1Whole framebuffer, compute series
H100-40CTime-sliced40 GB2Half the framebuffer
H100-20CTime-sliced20 GB4Quarter
H100-16CTime-sliced16 GB5 (4 in mixed-size mode)Fifth
H100-7-80CMIG-backed80 GB17 compute slices, MIG 7g.80gb
H100-4-40CMIG-backed40 GB1MIG 4g.40gb
H100-3-40CMIG-backed40 GB2MIG 3g.40gb
H100-2-20CMIG-backed20 GB3MIG 2g.20gb
H100-1-10CMIG-backed10 GB7MIG 1g.10gb
H100-1-10CMEMIG-backed10 GB11g.10gb with media engines

The pattern is <board>-[<compute slices>-]<framebuffer GB>C. Board variants get their own prefix (the H100 NVL 94 GB profiles are H100L-…, for example H100L-47C). In the vSphere Client the same types appear lowercase with an nvidia_ prefix; a VMware example shows nvidia_h100xm-20c for an SXM board. The authoritative list for your exact board is on the host: nvidia-smi vgpu -s, or nvidia-smi vgpu -s -v to see which GPU instance profile each MIG-backed type maps to.

NVIDIA’s own guidance for H100 time-sliced types is that profiles with 40 GB are aimed at inference and larger ones at training. Treat that as a starting point and let the sizing in section 07 decide.

04. Prepare the ESXi host

Install the Virtual GPU Manager

Download the host driver and the GPU management daemon components from the NVIDIA AI Enterprise Infra collection on NGC (ngc registry resource download-version "nvidia/vgpu/vgpu-host-driver-X:X.X"), or import them into a vSphere Lifecycle Manager image, which is what you want for a cluster. For a single host from the ESXi shell:

# All VMs on the host powered off or migrated first
esxcli system maintenanceMode set --enable true
esxcli software vib install -d /vmfs/volumes/<DATASTORE>/<HOST_DRIVER_COMPONENT>.zip
esxcli software vib install -d /vmfs/volumes/<DATASTORE>/<GPU_MGMT_DAEMON_COMPONENT>.zip
reboot
# after the reboot
esxcli system maintenanceMode set --enable false

Use esxcli software vib update -d … for upgrades. Host and guest drivers must be compatible: if you upgrade the host to a branch the guests do not support, the VMs boot with vGPU disabled until their guest drivers are updated. On HGX systems with NVSwitch, Fabric Manager is a separate package from NVIDIA AI Enterprise Infra 9.0 onwards and is installed after the Virtual GPU Manager.

vmkload_mod -l | grep nvidia            # module is "nvidia-gpu" on Ada Lovelace and later, "nvidia" before
/etc/init.d/nvdGpuMgmtDaemon status
nvidia-smi
nvidia-smi vgpu -s                       # supported vGPU types on each GPU

Set the graphics type to Shared Direct

After installation the GPU’s graphics type is Shared, and a VM with a vGPU will fail to power on with “The amount of graphics resource available in the parent resource pool is insufficient for the operation.” On VCF 9 the type is set per physical GPU; on earlier releases you can set the host default. Do this with all VMs on the host powered off.

# VCF 9: per GPU (bus ID from 'esxcli graphics device list')
esxcli graphics device set --device-id <PCI_BUS_ID> --type SharedPassthru

# vSphere 8: host default
esxcli graphics host set --default-type SharedPassthru

# then restart the host, or restart nv-hostengine:
nv-hostengine -t ; sleep 1 ; nv-hostengine -d

esxcli graphics device list
esxcli graphics host get

In the vSphere Client the same setting is Host, Configure, Graphics: confirm that both the active and configured type of every GPU you plan to use read Shared Direct.

Optional: enable MIG mode

MIG mode is off by default. Enable it per GPU from the ESXi shell while nothing is using the GPU. On ESXi with Ampere GPUs a host reboot is required afterwards; Hopper and later do not need one. You do not create GPU instances by hand on vSphere: NVIDIA’s documentation says vSphere creates them automatically, so you only pick MIG-backed profiles for the VMs.

nvidia-smi -i 0 -mig 1
nvidia-smi -i 0 --query-gpu=pci.bus_id,mig.mode.current --format=csv
pci.bus_id, mig.mode.current
00000000:3B:00.0, Enabled

Optional: allow vMotion of vGPU VMs

Suspend-resume of vGPU VMs works by default; vMotion needs the vCenter advanced setting vgpu.hotmigrate.enabled set to true (select the vCenter instance, Configure, Advanced Settings). NVIDIA documents limits: no migration between 80 GB PCIe and 94 GB NVL variants, none between H200, H800 and H100 boards, and MIG-backed VMs need a matching profile on the target.

05. Template: GPU VM checklist

#SettingValueWhyVerify
—————
1Guest OS64-bit Linux, Ubuntu LTS is the common choiceC-series vGPUs need a 64-bit guest that installs in EFI modeuname -m shows x86_64
2FirmwareEFIRequired for large-BAR GPUsVM Options, Boot Options
3Secure BootOff, or self-sign the NVIDIA moduleAn unsigned kernel module will not load under Secure Bootmokutil --sb-state
4Memory reservationReserve all guest memoryA VM with a PCI device or vGPU must have its full memory reservedResources, Memory, Reservation equals size
5pciPassthru.use64bitMMIOTRUELets firmware map the GPU BAR above 4 GBVM Options, Advanced, Configuration Parameters
6pciPassthru.64bitMMIOSizeGBFrom the table belowToo small and the VM fails to power onvmware.log has no msg.efi.pciMmioError
7vGPUAdd New Device, PCI Device, choose the C-series profileProfile fixes the framebuffer the VM will ever seenvidia-smi in the guest shows the profile name
8vCPU and RAMEnough RAM to stage the weights, plus OS and engine; NVIDIA’s own example VM uses 16 vCPU and 64 GBModel loading and tokenization run on the CPUfree -g during model load
9DiskFast datastore, room for model cache (tens to hundreds of GB)First start downloads weights; restarts read them backdf -h /opt/models
10LicensingClient configuration token in place, FeatureType=1Unlicensed vGPUs are throttled after 20 minutesnvidia-smi -q shows Licensed

Settings 5 and 6 are not only for passthrough. NVIDIA’s vGPU for Compute documentation states that on ESXi, a vGPU on a GPU that needs 64 GB or more of MMIO, assigned to a VM with 32 GB or more of memory, needs the VM’s MMIO space raised to the GPU’s requirement. NVIDIA’s table for common GPUs:

GPU64bitMMIOSizeGB
——
H100 (all variants), H800, A100 80 GB, H20 96 GB256
H200 (all variants), H20 141 GB512
B200 HGX, B300 HGX768
A100 40 GB, L40, L20, A40, RTX 6000 Ada128
L4, L2, A30, A1064

For passthrough of several GPUs to one VM, Broadcom’s rule is to add up the framebuffer of every GPU attached and round to a power of two: if the total is already a power of two, use the next one up; if it falls between two, round up and then up again. One 80 GB A100 therefore needs 256. On ESXi 9.1 a new mechanism derives MMIO sizes automatically and can overwrite a manual value at power-on; Broadcom KB 445982 documents pciPassthru.mmioSizeAutomatic = "FALSE" for when you need to keep yours.

06. Guest driver and licensing

Install the vGPU for Compute guest driver that matches the host driver branch (NGC: nvidia/vgpu/vgpu-guest-driver-X, as a .deb, .rpm or .run). Disable Nouveau first. Then license the VM against your NVIDIA License System instance: a Cloud License Service (CLS) instance, or a Delegated License Service (DLS) appliance on site.

sudo mkdir -p /etc/nvidia/ClientConfigToken
sudo cp client_configuration_token_<DATE>.tok /etc/nvidia/ClientConfigToken/
sudo chmod 744 /etc/nvidia/ClientConfigToken/client_configuration_token_*.tok
sudo cp /etc/nvidia/gridd.conf.template /etc/nvidia/gridd.conf
echo 'FeatureType=1' | sudo tee -a /etc/nvidia/gridd.conf     # 1 = NVIDIA vGPU; license type follows the vGPU type
sudo systemctl restart nvidia-gridd
nvidia-smi -q | grep -A2 'vGPU Software Licensed Product'
    vGPU Software Licensed Product
        Product Name                      : NVIDIA Virtual Compute Server
        License Status                    : Licensed (Expiry: <DATE>)

Know the two clocks. An unlicensed VM runs at full capability for 20 minutes and then drops compute performance to an idle level until it gets a license. A licensed VM that loses the license server keeps full capability for the grace period (7 days by default on CLS, configurable on DLS) and then degrades. Both look like “the model got slow” to an application team, which is why the license status belongs on a dashboard.

07. Sizing GPU memory for a model

A serving engine needs room for three things: the weights, the KV cache, and working overhead. Weights are fixed by the model and its precision. The KV cache grows with every token of every sequence held in memory. Overhead covers the CUDA context, activations and CUDA graphs, and is the least predictable part.

weights_bytes      = parameters × bytes_per_parameter × (1 + quant_overhead)
                     bytes_per_parameter: FP16/BF16 = 2, FP8/INT8 = 1, INT4 = 0.5
                     quant_overhead: scales and layers left in 16-bit, ~0.05 to 0.15 for INT4

kv_bytes_per_token = 2 × layers × kv_heads × head_dim × kv_bytes
                     (2 = one K and one V tensor per layer; kv_bytes = 2 for FP16/BF16, 1 for FP8)

kv_bytes_total     = kv_bytes_per_token × context_length × concurrent_sequences

needed             = weights + kv_total + overhead   ≤   profile_framebuffer × utilization

Read num_hidden_layers, num_key_value_heads and head_dim from the model’s config.json (when head_dim is absent it is hidden_size / num_attention_heads). Use the key-value head count, not the attention head count: models with grouped-query attention, which includes the Llama 3.1 family, keep far fewer KV heads, and using the wrong number overstates the cache by 4 to 8 times.

Worked example 1: Llama 3.1 8B on H100-40C

From its config: 32 layers, 8 KV heads, head_dim 128, about 8.03 billion parameters, BF16.

  • Weights: 8.03 × 2 = 16.1 GB.
  • KV per token (BF16): 2 × 32 × 8 × 128 × 2 = 131,072 bytes = 128 KiB.
  • Workload: 12 concurrent sequences at 8,192 tokens = 98,304 tokens × 128 KiB = 12.9 GB.
  • Overhead assumption: 3 GB.
  • Needed: 16.1 + 12.9 + 3 = 32.0 GB. Budget at 90 percent of a 40 GB profile: 36 GB. It fits, and the leftover KV room holds about 129,000 tokens, or 15 full-length sequences.

The same model on H100-20C fails: 16.1 GB of weights plus overhead leaves almost nothing for cache. On a 20 GB profile you would quantize the weights to FP8 or shrink the context.

Worked example 2: Llama 3.1 70B on one H100

80 layers, 8 KV heads, head_dim 128, about 70.6 billion parameters.

  • BF16 weights are 141 GB and FP8 weights are 70.6 GB. With FP8 weights, 70.6 GB plus overhead already exceeds the 72 GB budget of an 80 GB GPU, before a single token of cache. That model needs two GPUs with tensor parallelism (two full-framebuffer vGPUs or two passthrough GPUs), not one.
  • INT4 (AWQ or GPTQ style) weights: 70.6 × 0.5 × 1.12 ≈ 39.5 GB.
  • KV per token with an FP8 KV cache: 2 × 80 × 8 × 128 × 1 = 163,840 bytes = 160 KiB (320 KiB in BF16).
  • 16 sequences at 8,192 tokens: 131,072 tokens × 160 KiB = 21.5 GB. Overhead assumption: 4 GB.
  • Needed: 39.5 + 21.5 + 4 = 65.0 GB against a 72 GB budget on H100-80C. It fits, with room for about 21 full-length sequences.

What these numbers do not include

  • vGPU reservation. NVIDIA’s NIM documentation notes that the frame buffer usable inside a vGPU VM is less than the profile size, because the vGPU software reserves a portion. Check nvidia-smi in the guest and use its total, not the profile name, as your budget.
  • Real concurrency. Most requests never reach the maximum context. vLLM allocates KV cache in blocks as tokens arrive, so the full-length figure is a floor for concurrency, not a ceiling. Size for the worst case you must not reject, then measure.
  • Quality. INT4 weights and FP8 KV cache change model output. That is an evaluation question for the model owner, not a sizing one.

Template: sizing worksheet

InputWhere it comes fromYour value
———
Parameters (billions)Model card
Weight precision and quant overheadCheckpoint you will serve
Layers, KV heads, head_dimconfig.json
KV cache precisionEngine flag, for example --kv-cache-dtype fp8
Max context (prompt + output)Product requirement; becomes --max-model-len
Concurrent full-length sequencesPeak load you must not queue
OverheadAssumption; replace with a measurement after first start
Profile framebuffer usable in guestnvidia-smi in the VM
Utilization fractionEngine setting, for example --gpu-memory-utilization
ResultFits, or change profile, precision, context or GPU count

Template: sizing calculator

#!/usr/bin/env python3
"""llm_vram.py - rough GPU memory plan for serving one LLM replica.

Every input is an assumption you should replace with your own numbers.
Read layers, KV heads and head_dim from the model's config.json
(head_dim = hidden_size / num_attention_heads when head_dim is absent).
"""
import argparse

BYTES = {"fp16": 2.0, "bf16": 2.0, "fp8": 1.0, "int8": 1.0, "int4": 0.5}

p = argparse.ArgumentParser()
p.add_argument("--params-b", type=float, required=True, help="parameters, billions (8.03 for Llama 3.1 8B)")
p.add_argument("--weights", choices=BYTES, default="bf16")
p.add_argument("--quant-overhead", type=float, default=0.0,
               help="extra fraction for scales and unquantized layers, e.g. 0.10 for int4")
p.add_argument("--layers", type=int, required=True)
p.add_argument("--kv-heads", type=int, required=True)
p.add_argument("--head-dim", type=int, required=True)
p.add_argument("--kv-dtype", choices=BYTES, default="bf16")
p.add_argument("--context", type=int, required=True, help="max tokens per sequence (prompt + output)")
p.add_argument("--concurrency", type=int, required=True, help="sequences resident at full length")
p.add_argument("--overhead-gb", type=float, default=3.0, help="CUDA context, activations, graphs (assumption)")
p.add_argument("--profile-gb", type=float, required=True, help="vGPU profile or GPU framebuffer, GB")
p.add_argument("--util", type=float, default=0.90, help="fraction of framebuffer you allow the engine to use")
a = p.parse_args()

weights_gb = a.params_b * BYTES[a.weights] * (1 + a.quant_overhead)
kv_per_token = 2 * a.layers * a.kv_heads * a.head_dim * BYTES[a.kv_dtype]   # K and V
kv_gb = kv_per_token * a.context * a.concurrency / 1e9
need_gb = weights_gb + kv_gb + a.overhead_gb
budget_gb = a.profile_gb * a.util
kv_room_gb = budget_gb - weights_gb - a.overhead_gb
max_tokens = max(0, kv_room_gb * 1e9 / kv_per_token)

print(f"weights            {weights_gb:8.1f} GB")
print(f"KV per token       {kv_per_token/1024:8.0f} KiB")
print(f"KV for workload    {kv_gb:8.1f} GB  ({a.concurrency} x {a.context} tokens)")
print(f"overhead           {a.overhead_gb:8.1f} GB")
print(f"needed             {need_gb:8.1f} GB")
print(f"budget             {budget_gb:8.1f} GB  ({a.util:.0%} of {a.profile_gb:g} GB)")
print(f"KV tokens that fit {max_tokens:8.0f}  -> {int(max_tokens // a.context)} full-length sequences")
print("FITS" if need_gb <= budget_gb else "DOES NOT FIT")
python3 llm_vram.py --params-b 8.03 --weights bf16 --layers 32 --kv-heads 8 --head-dim 128 \
  --context 8192 --concurrency 12 --profile-gb 40
weights                16.1 GB
KV per token            128 KiB
KV for workload        12.9 GB  (12 x 8192 tokens)
overhead                3.0 GB
needed                 31.9 GB
budget                 36.0 GB  (90% of 40 GB)
KV tokens that fit   129242  -> 15 full-length sequences
FITS

08. Serving the model

vLLM in a VM, as a systemd service

Install Docker and the NVIDIA Container Toolkit in the guest, then run vLLM’s OpenAI-compatible server from the official image. The unit below pins the image tag, keeps secrets in an environment file readable only by root, uses host networking so the server can reach a collector on localhost, and sends traces to that collector over OTLP gRPC.

# /etc/vllm/vllm.env   (chmod 600, owned by root)
HF_TOKEN=<HUGGING_FACE_TOKEN>
VLLM_API_KEY=<API_KEY_FOR_CLIENTS>
MODEL=meta-llama/Llama-3.1-8B-Instruct
SERVED_MODEL_NAME=llama-3.1-8b
MAX_MODEL_LEN=8192
MAX_NUM_SEQS=12
GPU_MEM_UTIL=0.90
# /etc/systemd/system/vllm.service
[Unit]
Description=vLLM OpenAI-compatible server
After=docker.service network-online.target
Requires=docker.service
Wants=network-online.target

[Service]
EnvironmentFile=/etc/vllm/vllm.env
TimeoutStartSec=0
Restart=always
RestartSec=10
ExecStartPre=-/usr/bin/docker rm -f vllm
ExecStart=/usr/bin/docker run --rm --name vllm \
  --gpus all --ipc=host --network host \
  -v /opt/models/hf:/root/.cache/huggingface \
  -v /opt/models/vllm-cache:/root/.cache/vllm \
  -e HF_TOKEN -e VLLM_API_KEY \
  -e OTEL_SERVICE_NAME=vllm \
  -e OTEL_EXPORTER_OTLP_TRACES_INSECURE=true \
  vllm/vllm-openai:v0.34.0 \
  ${MODEL} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --max-model-len ${MAX_MODEL_LEN} \
  --max-num-seqs ${MAX_NUM_SEQS} \
  --gpu-memory-utilization ${GPU_MEM_UTIL} \
  --otlp-traces-endpoint grpc://127.0.0.1:4317
ExecStop=/usr/bin/docker stop vllm

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now vllm
journalctl -u vllm -f                       # wait for the server to report it is listening
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8000/health
curl -s http://127.0.0.1:8000/v1/models -H "Authorization: Bearer ${VLLM_API_KEY}"

Flags that map to the sizing worksheet: --max-model-len is the context length, --max-num-seqs caps concurrent sequences, --kv-cache-dtype fp8 halves the cache, and --tensor-parallel-size 2 splits a model across two GPUs. In vLLM 0.34, if you leave --gpu-memory-utilization unset, the default KV cache sizes itself from measured free memory; setting it explicitly, as here, keeps the cache size predictable and matches what you planned. The API key only guards the /v1 paths. /health and /metrics stay open, so keep port 8000 on a network you control. The Llama checkpoints are gated on Hugging Face, so the token must belong to an account that accepted the license.

NVIDIA NIM instead of vLLM

NIM packages a tuned engine and model profiles in one container and supports vGPU VMs. It listens on port 8000 and exposes the engine’s Prometheus metrics, with their vllm: prefix on vLLM-based images, at /v1/metrics rather than /metrics. From the NIM quickstart:

export NGC_API_KEY=<NGC_API_KEY>            # required for Production Branch (-pb) images
export LOCAL_NIM_CACHE=/opt/models/nim
mkdir -p "$LOCAL_NIM_CACHE"
docker run --gpus=all \
  -e NGC_API_KEY=$NGC_API_KEY \
  -e NIM_SERVED_MODEL_NAME="meta/llama-3.1-8b-instruct" \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -p 8000:8000 \
  nvcr.io/nim/meta/llama-3.1-8b-instruct:<NIM_TAG>

NIM picks a model profile for the detected GPU and memory; on vGPU, run its list-model-profiles command inside the VM to see which profiles fit the framebuffer you actually have.

On Kubernetes with the GPU Operator

To serve from a VKS cluster, give a node pool a VM class that includes the vGPU device, use Ubuntu nodes, and install the GPU Operator with NVIDIA’s AI Enterprise installer script from NGC. The script creates the gpu-operator namespace, the licensing ConfigMap from your client_configuration_token.tok, and the NGC pull secret for the prebuilt vGPU guest driver image. Do not preinstall the guest driver on the nodes; the operator installs it.

export NGC_API_KEY="<NGC_API_KEY>"
export NGC_USER_EMAIL="<NGC_ACCOUNT_EMAIL>"
cp client_configuration_token_<DATE>.tok client_configuration_token.tok
bash gpu-operator-nvaie.sh install          # file name as downloaded from NGC
kubectl get pods -n gpu-operator -o wide
kubectl exec -n gpu-operator <DRIVER_POD> -c nvidia-driver-ctr -- nvidia-smi -q | grep -A2 'Licensed Product'

The GPU Operator deploys a DCGM exporter by default (GPU Operator 26.7.3 ships DCGM Exporter 4.9.0). Read section 09 before you build dashboards on it in a vGPU cluster. The VKS tutorial covers building the cluster itself.

09. Observability with OpenTelemetry

What you can and cannot measure

Start with the constraint, because it shapes everything else. NVIDIA’s DCGM documentation lists supported virtualization as full passthrough only, and the NVIDIA AI Enterprise Infra 9 limitations page states that DCGM is not supported in vGPU environments, neither on hypervisor hosts running the Virtual GPU Manager nor inside time-sliced or MIG-backed vGPU guests: expect missing or zero metrics and profiling errors. So:

  • Passthrough VMs: run DCGM Exporter and use its metrics.
  • vGPU VMs: treat the serving engine’s metrics as the primary signal. nvidia-smi in the guest still reports usage for the vGPU, and on the host nvidia-smi vgpu -u shows per-vGPU engine utilization. VCF 9 adds a “vGPU Profile Utilization” view at cluster level in the vSphere Client showing consumed and remaining profile capacity.

This is less of a loss than it sounds. vLLM reserves its KV cache at startup, so “GPU memory used” is a flat line near the budget whether the server is idle or saturated. The metrics that tell you a model server is in trouble live in the engine.

SignalMetric (vLLM 0.34)What it tells you
———
KV cache pressurevllm:kv_cache_usage_perc (0 to 1)Near 1 means new requests wait for cache; the true capacity signal
Queuevllm:num_requests_waiting, vllm:num_requests_runningWaiting above zero for minutes means you are out of capacity
Preemptionvllm:num_preemptions (counter)Running requests evicted to make room; latency spikes follow
Time to first tokenvllm:time_to_first_token_seconds (histogram)What users feel as “slow to start”
Inter-token latencyvllm:inter_token_latency_seconds (histogram)Streaming smoothness; rises with compute contention on time-sliced GPUs
End-to-end latencyvllm:e2e_request_latency_seconds (histogram)SLO metric
Throughputvllm:prompt_tokens, vllm:generation_tokens (counters)Tokens per second in and out

Counters are exposed with a _total suffix and histograms with _bucket, _sum and _count.

DCGM metric names changed in late 2026

If you run DCGM Exporter on passthrough VMs, note that DCGM Exporter 4.9.0 renamed its default metrics to DCGM 4.7 names and changed several units, and 4.10.0 renamed the PCIe throughput fields again. Dashboards and alerts built on the old names go silent after an upgrade. The default set, old and new:

Up to 4.8.x4.9.0 and laterUnit change
———
DCGM_FI_DEV_GPU_UTILDCGM_FI_DEV_GPU_UTIL_RATIOpercent to 0-1 ratio
DCGM_FI_DEV_MEM_COPY_UTILDCGM_FI_DEV_MEMORY_UTIL_RATIOpercent to ratio
DCGM_FI_DEV_FB_USED, _FB_FREE, _FB_RESERVEDDCGM_FI_DEV_FB_USED_BYTES, _FB_FREE_BYTES, _FB_RESERVED_BYTESMiB to bytes
(not collected by default)DCGM_FI_DEV_FB_CAPACITY_BYTESnew default
DCGM_FI_DEV_GPU_TEMP, _MEMORY_TEMPDCGM_FI_DEV_GPU_TEMP_CELSIUS, _MEMORY_TEMP_CELSIUSnone
DCGM_FI_DEV_POWER_USAGEDCGM_FI_DEV_BOARD_POWER_WATTSnone
DCGM_FI_DEV_TOTAL_ENERGY_CONSUMPTIONDCGM_FI_DEV_GPU_ENERGY_JOULES_TOTALmJ to J
DCGM_FI_DEV_SM_CLOCK, _MEM_CLOCKDCGM_FI_DEV_SM_CLOCK_HERTZ, _MEMORY_CLOCK_HERTZMHz to Hz
DCGM_FI_DEV_XID_ERRORSDCGM_FI_DEV_XID_ERRORnone
DCGM_FI_DEV_PCIE_REPLAY_COUNTERDCGM_FI_DEV_PCIE_REPLAY_TOTALnone
DCGM_FI_PROF_GR_ENGINE_ACTIVEDCGM_FI_PROF_GR_ENGINE_UTIL_RATIOnone
DCGM_FI_PROF_PIPE_TENSOR_ACTIVEDCGM_FI_PROF_TENSOR_UTIL_RATIOnone
DCGM_FI_PROF_DRAM_ACTIVEDCGM_FI_PROF_DRAM_UTIL_RATIOnone
DCGM_FI_PROF_PCIE_TX_BYTES, _RX_BYTESDCGM_FI_PROF_PCIE_TX_BYTES_PER_SECOND, _RX_BYTES_PER_SECOND (4.10.0)none
DCGM_FI_DEV_VGPU_LICENSE_STATUSunchangednone
label DCGM_FI_DRIVER_VERSIONlabel DCGM_FI_SYSTEM_DRIVER_VERSIONnone

On a passthrough VM, run the exporter next to the engine. The SYS_ADMIN capability is needed for the DCGM_FI_PROF_* profiling fields.

docker run -d --restart unless-stopped --name dcgm-exporter \
  --gpus all --cap-add SYS_ADMIN -p 127.0.0.1:9400:9400 \
  nvcr.io/nvidia/k8s/dcgm-exporter:<DCGM_EXPORTER_TAG>
curl -s http://127.0.0.1:9400/metrics | grep -m3 '^DCGM_'

The collector

Use the contrib distribution (otelcol-contrib), installed from the release .deb or .rpm, which brings a systemd unit that reads /etc/otelcol-contrib/config.yaml and an environment file at /etc/otelcol-contrib/otelcol-contrib.conf. The configuration below scrapes vLLM and DCGM with the prometheus receiver, takes vLLM’s traces on OTLP gRPC bound to localhost, adds a few host metrics, and exports metrics with Prometheus remote write and traces to Tempo.

Component names changed in recent collector releases. This file uses the current snake_case names (host_metrics, resource_detection, prometheus_remote_write, otlp_grpc); the old names still work as deprecated aliases. The batch processor is deprecated: batching now lives on the exporter (sending_queue.batch), except for the remote write exporter, which has its own remote_write_queue. The prometheus receiver is beta, the remote write exporter is beta and the host metrics receiver is beta for metrics. This configuration validates with otelcol-contrib validate on 0.166.0.

# /etc/otelcol-contrib/config.yaml  on the inference VM
# Secrets come from /etc/otelcol-contrib/otelcol-contrib.conf (systemd EnvironmentFile)
extensions:
  health_check:
    endpoint: 127.0.0.1:13133
  basic_auth/prw:
    client_auth:
      username: ${env:PRW_USERNAME}
      password: ${env:PRW_PASSWORD}

receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: vllm
          scrape_interval: 15s
          metrics_path: /metrics            # NIM: /v1/metrics
          static_configs:
            - targets: ["127.0.0.1:8000"]
              labels:
                model: ${env:SERVED_MODEL_NAME}
        - job_name: dcgm                    # passthrough VMs only; remove on vGPU
          scrape_interval: 15s
          static_configs:
            - targets: ["127.0.0.1:9400"]
  otlp:
    protocols:
      grpc:
        endpoint: 127.0.0.1:4317           # vLLM --otlp-traces-endpoint
  host_metrics:
    collection_interval: 30s
    scrapers:
      cpu: {}
      memory: {}
      load: {}
      network: {}
      filesystem: {}

processors:
  memory_limiter:
    check_interval: 5s
    limit_mib: 400
    spike_limit_mib: 100
  resource_detection:
    detectors: [system]
    system:
      hostname_sources: [os]
  resource/inference:
    attributes:
      - key: deployment.environment.name
        value: ${env:DEPLOY_ENV}
        action: upsert
      - key: gpu.sharing_mode             # custom: passthrough | vgpu-timesliced | vgpu-mig
        value: ${env:GPU_SHARING_MODE}
        action: upsert
      - key: gpu.vgpu_profile             # custom: e.g. H100-40C
        value: ${env:VGPU_PROFILE}
        action: upsert

exporters:
  prometheus_remote_write:
    http:
      endpoint: https://<MIMIR_OR_PROMETHEUS_FQDN>/api/v1/push
      auth:
        authenticator: basic_auth/prw
      tls:
        ca_file: /etc/otelcol-contrib/ca.pem
    resource_constant_labels:
      included: ["host.name", "deployment.environment.name", "gpu.sharing_mode", "gpu.vgpu_profile"]
  otlp_grpc/tempo:
    endpoint: <TEMPO_FQDN>:4317
    tls:
      ca_file: /etc/otelcol-contrib/ca.pem
    sending_queue:
      batch: {}

service:
  extensions: [health_check, basic_auth/prw]
  pipelines:
    metrics:
      receivers: [prometheus, host_metrics]
      processors: [memory_limiter, resource_detection, resource/inference]
      exporters: [prometheus_remote_write]
    traces:
      receivers: [otlp]
      processors: [memory_limiter, resource_detection, resource/inference]
      exporters: [otlp_grpc/tempo]
# /etc/otelcol-contrib/otelcol-contrib.conf   (chmod 640, group otelcol-contrib)
OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/config.yaml"
PRW_USERNAME=<PRW_USERNAME>
PRW_PASSWORD=<PRW_PASSWORD>
SERVED_MODEL_NAME=llama-3.1-8b
DEPLOY_ENV=prod
GPU_SHARING_MODE=vgpu-timesliced
VGPU_PROFILE=H100-40C

gpu.sharing_mode and gpu.vgpu_profile are custom attributes, not semantic conventions. They earn their place the first time someone asks why the same model has twice the inter-token latency on one VM: the answer is usually that VM is on a busy time-sliced GPU and the other one is on a MIG slice. resource_constant_labels turns those resource attributes into labels on every series so you can group by them in Grafana.

Grafana queries and alert rules

Metric names pass through the receiver and the remote write translation; check the exact names in Grafana Explore before saving a dashboard, especially counters (_total) and anything with a colon.

# inference-alerts.yaml  (Prometheus rule format: Mimir ruler, Prometheus, or import into Grafana)
groups:
  - name: llm-inference
    rules:
      - alert: LLMKVCacheSaturated
        expr: avg_over_time(vllm:kv_cache_usage_perc[5m]) > 0.90
        for: 10m
        labels: {severity: warning}
        annotations:
          summary: "KV cache above 90% on {{ $labels.host_name }} ({{ $labels.model }})"
      - alert: LLMRequestsQueueing
        expr: min_over_time(vllm:num_requests_waiting[5m]) > 0
        for: 5m
        labels: {severity: warning}
        annotations:
          summary: "Requests waiting continuously for 5m on {{ $labels.host_name }}"
      - alert: LLMTimeToFirstTokenHigh
        expr: |
          histogram_quantile(0.95,
            sum by (le, model) (rate(vllm:time_to_first_token_seconds_bucket[5m]))) > 2
        for: 10m
        labels: {severity: warning}
        annotations:
          summary: "p95 time to first token above 2s for {{ $labels.model }}"
      - alert: LLMPreemptions
        expr: rate(vllm:num_preemptions_total[10m]) > 0
        for: 10m
        labels: {severity: info}
        annotations:
          summary: "vLLM is preempting running requests on {{ $labels.host_name }}"
      - alert: LLMScrapeDown
        expr: up{job="vllm"} == 0
        for: 2m
        labels: {severity: critical}
        annotations:
          summary: "vLLM metrics endpoint down on {{ $labels.host_name }}"
      - alert: GPUXidErrorPassthrough
        expr: changes(DCGM_FI_DEV_XID_ERROR[10m]) > 0
        labels: {severity: critical}
        annotations:
          summary: "New XID error on {{ $labels.host_name }} GPU {{ $labels.gpu }}"

The 2 second TTFT and 90 percent thresholds are starting points. Set them from a week of your own data. The label used for the host (host_name here) depends on how the remote write exporter sanitizes host.name; confirm it in Explore. For traces, each vLLM request becomes a span carrying request metadata, and if your application propagates trace context the model call shows up inside the caller’s trace, which is the link that turns “the chatbot is slow” into “TTFT on this VM”.

10. End-to-end workflow

Step 1. Host BIOS and driver

Enable SR-IOV, VT-d/IOMMU and MMIO above 4 GB, install the Virtual GPU Manager components and reboot.

vmkload_mod -l | grep nvidia
nvidia-smi
Expected: an nvidia or nvidia-gpu module line; nvidia-smi lists every GPU with the host driver version

Step 2. Graphics type (and MIG if used)

esxcli graphics device list
nvidia-smi -i 0 --query-gpu=mig.mode.current --format=csv     # only if using MIG
Expected: each GPU configured and active as SharedPassthru (Shared Direct in the UI); MIG Enabled where wanted

Step 3. Create the VM

Apply the section 05 checklist: EFI, all memory reserved, MMIO parameters, then add the C-series vGPU as a PCI device.

Verify:   the VM powers on
Expected: no "graphics resource ... insufficient" error and no msg.efi.pciMmioError in vmware.log

Step 4. Guest driver and license

nvidia-smi
nvidia-smi -q | grep -A2 'vGPU Software Licensed Product'
Expected: the vGPU type (for example NVIDIA H100-40C) with its framebuffer, and License Status: Licensed

Step 5. Container toolkit

docker run --rm --gpus=all nvidia/cuda:12.6.3-base-ubuntu24.04 nvidia-smi
Expected: the same GPU table printed from inside a container

Step 6. Size the model

python3 llm_vram.py --params-b 8.03 --weights bf16 --layers 32 --kv-heads 8 --head-dim 128 \
  --context 8192 --concurrency 12 --profile-gb <FRAMEBUFFER_GB_FROM_NVIDIA_SMI>
Expected: FITS; copy context and concurrency into /etc/vllm/vllm.env

Step 7. Start vLLM

sudo systemctl enable --now vllm
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8000/health
curl -s http://127.0.0.1:8000/v1/chat/completions \
  -H "Authorization: Bearer ${VLLM_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"model":"llama-3.1-8b","messages":[{"role":"user","content":"Say hello"}],"max_tokens":16}'
Expected: 200 from /health once the model has loaded; a JSON chat completion with a "choices" array

Step 8. Check the engine metrics

curl -s http://127.0.0.1:8000/metrics | grep -E '^vllm:(kv_cache_usage_perc|num_requests_waiting)'
Expected: both series present, kv_cache_usage_perc above 0 while a request is running

Step 9. Start the collector

# load the same env file systemd uses, or the ${env:...} values are empty and validation fails
sudo bash -c 'set -a; . /etc/otelcol-contrib/otelcol-contrib.conf; otelcol-contrib validate --config=file:/etc/otelcol-contrib/config.yaml'
sudo systemctl restart otelcol-contrib
curl -s http://127.0.0.1:13133/
journalctl -u otelcol-contrib --since "5 min ago" | grep -iE 'error|refused' || echo "no errors"
Expected: validate exits silently; the health endpoint reports the server available; "no errors"

Step 10. Confirm in Grafana

In Explore, query vllm:kv_cache_usage_perc and up{job="vllm"}, then search Tempo for service vllm.

Expected: series labelled with your model, host and gpu_sharing_mode; one trace per request in Tempo

Step 11. Load test and compare with the plan

Run a load generator at your target concurrency and watch KV cache usage, waiting requests and TTFT. If the cache saturates well below the concurrency the worksheet predicted, your overhead or usable framebuffer assumption was wrong: update the worksheet with the measured values.

11. Troubleshooting

SymptomLikely causeCheckFix
————
VM power-on fails: “The amount of graphics resource available in the parent resource pool is insufficient”GPU still in Shared modeesxcli graphics device listSet Shared Direct (SharedPassthru) and restart nv-hostengine or the host
Power-on fails with DevicePowerOn or msg.efi.pciMmioError in vmware.log64-bit MMIO missing or too small, or BIOS MMIO above 4 GB disabledVM advanced parameters; BIOSSet the values from section 05; on ESXi 9.1 check automatic MMIO did not override them
No nvidia module after rebootComponent not installed, or looking for the wrong module nameesxcli software vib list | grep -i nv; vmkload_mod -lReinstall; on Ada and later the module is nvidia-gpu
No C-series profiles in Device SelectionvWS/vPC Virtual GPU Manager installed instead of vGPU for Compute, or MIG profiles wanted with MIG offnvidia-smi vgpu -s on the hostInstall the NVIDIA AI Enterprise host driver; enable MIG for MIG-backed types
Guest nvidia-smi: no devices foundSecure Boot blocking the module, or Nouveau loadedmokutil --sb-state; lsmod | grep nouveauDisable Secure Boot or sign the module; blacklist Nouveau and rebuild initramfs
Model fine for 20 minutes, then very slowVM never licensednvidia-smi -q license status; journalctl -u nvidia-griddFix token, FeatureType and network path to CLS or DLS
Slow after days of being fineLicense server unreachable past the grace periodSame as aboveRestore NLS reachability; alert on license status
vLLM exits with “No available memory for the cache blocks”Weights plus overhead fill the budgetStartup log; worksheetLarger profile, FP8 or INT4 weights, more GPUs, or lower utilization elsewhere
vLLM refuses the configured max lengthKV cache cannot hold one sequence of --max-model-lenStartup log suggests a lower estimateLower --max-model-len or use --kv-cache-dtype fp8
DCGM metrics zero or missing in a vGPU VMDCGM is not supported in vGPU guestsNVIDIA AI Enterprise limitationsUse engine metrics; use DCGM on passthrough VMs only
Dashboards empty after a DCGM Exporter upgrade4.9.0 metric renamescurl :9400/metrics | grep ^DCGM_Update queries to the new names in section 09
vMotion not offered for the VMvgpu.hotmigrate.enabled off, passthrough device, or unsupported board pairvCenter advanced settings; device typeEnable the setting; passthrough VMs cannot vMotion
Inter-token latency jumps at certain times of dayNeighbours on a time-sliced GPUHost nvidia-smi vgpu -u; gpu_sharing_mode labelMove to MIG-backed, change scheduler policy, or spread VMs across GPUs

12. Where VMware Private AI Foundation with NVIDIA fits

Everything above is the manual path. VMware Private AI Foundation with NVIDIA packages the same building blocks on VCF: GPU-enabled ESX hosts with the vGPU host driver (time-sliced or MIG), a Supervisor, VKS clusters with the NVIDIA GPU Operator, deep learning VM images and VKr images delivered through content libraries, a Harbor registry for disconnected sites, vector databases through VMware Data Services Manager, NVIDIA licensing through the NVIDIA Licensing Portal or a DLS appliance, self-service catalog items in VCF Automation, and GPU consumption monitoring in VCF Operations. VCF 9 added Private AI Services, a Supervisor service for running models and AI applications with a model store. Per Broadcom’s 9.1 documentation, AI workloads can run on vGPU, which needs an NVIDIA AI Enterprise license and Production Branch containers pulled with an NGC API key, or from VCF 9.1 on GPU passthrough, which needs neither the license nor the vGPU host driver but gives up vMotion. If you are on VCF and expect more than a couple of model servers, evaluate it before you script your own.

13. What’s next

For the GPU basics on ESXi and how GPUs can also accelerate storage paths, start with Using NVIDIA GPUs in VMware ESXi and leveraging GPU for NFS storage. To run the model on Kubernetes instead of a single VM, the vSphere Kubernetes Service tutorial builds the cluster, and Part 5 of the OTel series adds the collector tiers. The backends this collector writes to are set up in Part 4: backends and Grafana, and Sizing the OTel Collector for vSphere covers what happens when you put one of these collectors in every GPU VM.

Checked against NVIDIA AI Enterprise Infra 9.1 (vGPU for Compute) documentation, the NVIDIA vGPU 21 user guide for VMware vSphere, NVIDIA License System client guide, DCGM Exporter 4.9.0 and 4.10.0 release notes and default counters, NIM for LLMs 2.1.7, vLLM 0.34.0 source, Broadcom KBs 334594 and 445982, the ESXCLI 9.0 graphics reference, VMware Private AI Foundation with NVIDIA 9.0 and 9.1 docs, and OpenTelemetry Collector contrib 0.166.0. Sizing figures are planning estimates; measure on your own hardware before committing capacity.

One response

  1. […] which is exactly the path the StatefulSet in this post exercises. If your next cluster needs GPUs, running LLM inference on vSphere with NVIDIA vGPU covers the host, VM and sizing […]

Leave a Reply