{"slug": "autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu", "title": "Autoscaling LLM inference on Kubernetes with vLLM: stop scaling on GPU utilisation", "summary": "A practitioner published a how-to for autoscaling self-hosted vLLM inference on Kubernetes, arguing that scaling on NVIDIA's DCGM_FI_DEV_GPU_UTIL metric is unreliable because vLLM pins GPU duty cycle near 100% regardless of request rate. The guide recommends a three-signal approach wired through KEDA and HPA over Karpenter: vLLM queue depth (vllm:num_requests_waiting) as the primary trigger, p95 TTFT or end-to-end latency as a guardrail, and KV-cache usage as a backstop, with thresholds set from a real load test. In that load test, p95 end-to-end latency rose from about 2.5 seconds to 6-10 seconds while a utilisation-based scaler would still be deciding.", "body_md": "If you self-host vLLM on Kubernetes and your Horizontal Pod Autoscaler scales on DCGM_FI_DEV_GPU_UTIL, you are scaling on a metric that sits near 100% whether you serve a handful of requests a second or a few hundred. You pay for idle GPUs overnight and still shed load at the morning peak. Here is how to autoscale LLM inference on Kubernetes when the server is vLLM: measure the three signals that actually track demand (queue depth, p95 latency, KV-cache utilisation), wire them through KEDA and HPA over Karpenter, and set thresholds from a real load test. The result is replicas that appear before users notice and disappear when the traffic does.\n\nIf you run LLM inference on your own GPUs, whether in a UAE colocation facility, on a private cloud in the GCC, or on regional public cloud instances, your cost base is whole GPU-hours. Autoscaling is the only lever that converts a static GPU fleet into a cost that tracks demand. But the default Kubernetes scaling signal actively works against you on inference workloads. This article is the how-to: how to autoscale LLM inference on Kubernetes when the model server is vLLM, with the metric definitions, thresholds, manifests and operational pitfalls that matter in production.\n\nThe obvious first attempt is the one almost every team makes: an HPA on `DCGM_FI_DEV_GPU_UTIL` from the NVIDIA DCGM exporter. It fails for a specific, documented reason.\n\n`DCGM_FI_DEV_GPU_UTIL` measures duty cycle, meaning the fraction of time the GPU is executing a kernel. It does not measure how much work the GPU is doing while it is busy. [Amazon's EKS guidance for ML inference](https://docs.aws.amazon.com/eks/latest/userguide/ml-inference-autoscaling.html) states it plainly: an inference server such as vLLM can stay near 100% utilisation across a wide range of incoming request rates, so utilisation is an unreliable autoscaling signal and you should scale on leading indicators instead. [Google's GKE best-practices guide](https://cloud.google.com/kubernetes-engine/docs/best-practices/machine-learning/inference/autoscaling) makes the same point: GPU utilisation \"does not measure how much work is being done while the GPU is active\", which makes it impossible to map a latency target to a utilisation threshold.\n\nWhy vLLM behaves this way is worth understanding, because it explains everything downstream:\n\n`--gpu-memory-utilization` defaults to 0.9). Framebuffer usage therefore barely moves with traffic. GKE notes that `DCGM_FI_DEV_FB_USED` can drive scale-up for dynamic allocators but will never scale down a server like vLLM or TGI that holds its memory.\nThe operational consequences are predictable. A utilisation-driven HPA either never scales in, because utilisation never drops below the threshold, or it oscillates on noise. At the same time it scales out late, because utilisation is a lagging indicator: by the time you act, requests are already queued and time to first token (TTFT) is already climbing. In the load test we will walk through below, p95 end-to-end latency went from about 2.5 seconds to 6–10 seconds in the window where a utilisation-based scaler would still be \"deciding\".\n\nAWS, Google and the vLLM project converge on the same answer: no single metric suffices, so use three layers, each catching demand earlier or more reliably than the one before.\n\n| Signal | vLLM Prometheus metric | Role | Example starting trigger | \n|---|---|---|---|\n| Queue depth | `vllm:num_requests_waiting` | Primary trigger. A waiting queue forms the instant demand exceeds capacity, so it is the best leading indicator. | Average waiting requests per pod above 25 for 30–60 s | \n| Latency | `vllm:time_to_first_token_seconds` (p95) or`vllm:e2e_request_latency_seconds` (p95) | Guardrail. Fires when responses are slow even before a queue builds, protecting the user-facing SLO. | p95 TTFT above 2 s, or p95 end-to-end above 5 s | \n| KV-cache pressure | `vllm:kv_cache_usage_perc` (0 to 1) | Backstop. As the KV cache fills, the engine starts preempting and rejecting work; scale before that happens. | Fullest replica above 0.85 | \n\nTwo more metrics earn a place on the dashboard even if they do not drive scaling directly. `vllm:num_requests_running` counts requests currently in model batches and is a proactive concurrency signal: [Google's Cloud Run tutorial for vLLM](https://docs.cloud.google.com/run/docs/tutorials/autoscale-vllm-with-gpu-metrics) scales on exactly this metric, because it reflects genuine GPU load before the waiting queue appears. And `vllm:prefix_cache_hits` against `vllm:prefix_cache_queries` tells you how much duplicate prefill work your replicas are reusing, which matters more than people expect after a scale-out event.\n\nOne trap to check before you copy any PromQL from anywhere: metric names move between vLLM releases. Current vLLM documentation lists `vllm:kv_cache_usage_perc` as a gauge of used KV-cache blocks (0 to 1), while Google's tutorial shows the older `vllm:gpu_cache_usage_perc` name. Always curl your own `/metrics` endpoint and confirm what your deployed version actually exports.\n\nNumbers beat guesswork. AWS's EKS inference guide publishes a complete threshold-setting walkthrough, and it doubles as the method you should copy.\n\nThe test runs Ministral-3-8B-Instruct-2512 on a `g6e.4xlarge` with a single vLLM replica behind kube-prometheus-stack. Before measuring anything, it sends 100 sequential requests with k6 to finish one-time initialisation: CUDA graph capture, kernel autotuning, KV-cache pool allocation and GPU clock ramp. If you skip this, your thresholds record startup work instead of steady-state capacity.\n\nThen k6 drives a constant-arrival-rate scenario at 10, 20, 30, 40, 50, 60 and 70 requests per second, 60 seconds per rate with a 30-second pause between rates, with prompts varied to defeat prefix caching.\n\nIn AWS's published results, queue depth (`vllm:num_requests_waiting`) stayed near zero up to 50 requests per second, then jumped sharply at 60 requests per second to roughly 150–350 waiting requests. Over the same window, p95 end-to-end latency (`vllm:e2e_request_latency_seconds`) rose from a baseline of about 2.5 seconds to 6–10 seconds. That inflection is your replica's capacity ceiling.\n\nAWS's derived starting values: scale out when average queue depth exceeds 25 waiting requests per pod, or when p95 end-to-end latency exceeds 5 seconds, each sustained for 30–60 seconds. Scale in only when queue depth is zero and p95 latency is below 3 seconds for a full 5 minutes. Google's guidance recommends a much tighter per-pod queue-size target, starting at 3–5 waiting requests and raising it until latency degrades, which suits latency-sensitive workloads; batch-size triggers (`vllm:num_requests_running`) give the tightest latency control at the cost of throughput. Both are legitimate. The right threshold is the one you measured on your model, your GPU and your prompt shapes.\n\nTake a concrete scenario: a GCC bank's internal assistant, one 8B-class model, replicas sized one NVIDIA L4 (24 GB) each, single-GPU nodes. For illustration, AWS list price for a `g6.xlarge` (1× L4) in us-east-1 was about $0.8048 per hour on demand at the time of writing, roughly $587.50 per month; check your own region's price list and commitment terms, since UAE regions price differently. The shape of the maths is what matters, and on owned hardware in a Dubai data centre the same calculation is simply GPU-hours.\n\nInference autoscaling happens in two stages and you need both. Karpenter provisions GPU nodes when pods cannot be scheduled; HPA adjusts the replica count to hold your chosen metric near target. Note that GPUs are allocated as whole units through the NVIDIA device plugin, so replicas, GPUs and nodes map one-to-one on single-GPU instance types and one-per-GPU on multi-GPU nodes. Nothing here works without metrics plumbing: a Prometheus scrape of vLLM's `/metrics` endpoint via a ServiceMonitor, and an autoscaler that can query it. KEDA is the simplest route, because its Prometheus scaler queries Prometheus directly and then owns a standard HPA for you.\n\nStart with these PromQL expressions. The `or vector(0)` clauses matter: without them an idle server returns an empty result and the trigger misbehaves.\n\n```\n# Primary: requests waiting in the vLLM scheduler queue\nsum(vllm:num_requests_waiting) or vector(0)\n\n# Guardrail: p95 time to first token in seconds, 2 minute window\nhistogram_quantile(0.95, sum(rate(vllm:time_to_first_token_seconds_bucket[2m])) by (le))\n\n# Backstop: fullest replica's KV-cache block usage, 0 to 1\nmax(vllm:kv_cache_usage_perc) or vector(0)\n```\n\nThen a `ScaledObject` with all three triggers. Thresholds below are the AWS-measured values for an 8B model on one GPU plus a KV-cache backstop; substitute your own. The behaviour block is deliberate: scale out aggressively, scale in conservatively.\n\n```\napiVersion: keda.sh/v1alpha1\nkind: ScaledObject\nmetadata:\n  name: vllm-inference-app\n  namespace: inference\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: vllm-inference-app\n  minReplicaCount: 1\n  maxReplicaCount: 6\n  pollingInterval: 15\n  cooldownPeriod: 300\n  advanced:\n    horizontalPodAutoscalerConfig:\n      behavior:\n        scaleUp:\n          stabilizationWindowSeconds: 30\n          policies:\n            - type: Pods\n              value: 2\n              periodSeconds: 60\n              selectPolicy: Max\n        scaleDown:\n          stabilizationWindowSeconds: 300\n          policies:\n            - type: Pods\n              value: 1\n              periodSeconds: 120\n              selectPolicy: Min\n  triggers:\n    # Primary: queue depth, per-pod average (AWS measured threshold: 25)\n    - type: prometheus\n      metricType: AverageValue\n      metadata:\n        serverAddress: http://prometheus.monitoring.svc:9090\n        query: sum(vllm:num_requests_waiting) or vector(0)\n        threshold: \"25\"\n        activationThreshold: \"1\"\n    # Guardrail: p95 TTFT in seconds\n    - type: prometheus\n      metricType: AverageValue\n      metadata:\n        serverAddress: http://prometheus.monitoring.svc:9090\n        query: histogram_quantile(0.95, sum(rate(vllm:time_to_first_token_seconds_bucket[2m])) by (le)) or vector(0)\n        threshold: \"2\"\n    # Backstop: KV-cache usage on the busiest replica\n    - type: prometheus\n      metricType: MaxValue\n      metadata:\n        serverAddress: http://prometheus.monitoring.svc:9090\n        query: max(vllm:kv_cache_usage_perc) or vector(0)\n        threshold: \"0.85\"\n```\n\nKEDA creates and manages the backing HPA. Do not create a second HPA for the same Deployment; two HPAs on one target conflict. `activationThreshold: \"1\"` keeps the deployment at its minimum until at least one request is actually waiting, so idle traffic does not wake GPUs.\n\nTwo more pieces complete the picture. First, a startup probe that refuses to mark the pod Ready until the model is genuinely serving, so the scheduler never routes traffic into a loading replica:\n\n```\nstartupProbe:\n  httpGet:\n    path: /health\n    port: 8000\n  periodSeconds: 10\n  failureThreshold: 24   # budgets up to 240s for weights load and warm-up\n```\n\nSecond, a Karpenter `NodePool` with a flexible instance-type list so that a capacity shortage in one type or zone does not leave pods Pending, plus a `consolidateAfter` delay so empty nodes are not reclaimed the instant a replica moves:\n\n```\napiVersion: karpenter.sh/v1\nkind: NodePool\nmetadata:\n  name: gpu-inference\nspec:\n  disruption:\n    consolidationPolicy: WhenEmptyOrUnderutilized\n    consolidateAfter: 5m\n  template:\n    spec:\n      requirements:\n        - key: node.kubernetes.io/instance-type\n          operator: In\n          values: [\"g6.xlarge\", \"g6.2xlarge\"]\n```\n\nProtect in-flight requests during consolidation with a PodDisruptionBudget, or the `karpenter.sh/do-not-disrupt` annotation on pods you never want evicted mid-decode.\n\n| Approach | Scales on | Strengths | Weaknesses | Fits | \n|---|---|---|---|---|\n| HPA on DCGM GPU utilisation | Duty cycle | No extra components | Wrong signal for inference; late scale-out, sticky scale-in | Nothing. Remove it | \n| HPA + Prometheus Adapter on vLLM metrics | Queue, latency, KV cache | Standard HPA semantics | You run the adapter; no activation thresholds | Small single-model setups | \n| KEDA `ScaledObject` on vLLM metrics | As above | Activation thresholds, scale-to-zero option, owns the HPA, direct Prometheus queries | One more component in the cluster | The default choice for most teams | \n| llm-d with KEDA and the Gateway API Inference Extension (EPP) | EPP demand signals: queue size, in-flight requests, pool saturation, estimated latency | Demand-side view across a pool; cache-aware routing included | More moving parts; needs an Envoy-based gateway | Large multi-replica pools serving one model | \n| Serverless GPU platform (Modal, RunPod Serverless and similar) | Platform-managed | Scale to zero, per-second billing, no cluster to run | Lock-in, request-duration and concurrency limits, data-residency constraints | Batch jobs, spiky internal tools, overflow | \n\nFor a GCC organisation with data-residency obligations, the last row needs scrutiny before adoption. If your prompts and completions must stay inside your jurisdiction or inside your own network, the first four rows are the whole menu.\n\n[Suranand Bootcamp's walkthrough of LLM autoscaling and serverless GPU hosting](https://bootcamp.suryanand.com) covers most of these; here is what they mean in a vLLM-on-Kubernetes deployment.\n\n**Scale-up lag versus bursts.** Even a perfect autoscaler cannot react faster than a replica can become useful. The chain is: KEDA polls (15 s in the config above), the HPA scale-up window passes (30 s), pods go Pending, Karpenter launches a node, the runtime pulls the image and loads weights, and vLLM completes one-time warm-up. Google's vLLM tutorial budgets up to 240 seconds of startup before its readiness probe fails, and AWS's warm-up procedure sends 100 sequential requests to finish CUDA graph and kernel initialisation. Budget two to five minutes from signal to serving. Mitigate by holding a warm minimum replica for latency-sensitive models, pre-staging weights on fast local NVMe or a mounted volume rather than downloading from a hub, pre-pulling images onto GPU nodes, and using low-priority placeholder pods to reserve node capacity that real pods can evict.\n\n**Flapping on slow-starting replicas.** Short cooldowns on expensive, slow-starting pods cause churn that costs more than the idle time you were avoiding. Keep scale-down windows long (5 minutes in the AWS example, 1 pod per 2 minutes at most), remember HPA's default 0.1 no-action tolerance around the target, and keep KEDA's `cooldownPeriod` at 300 seconds or above. Scale up like a sprinter, scale down like a librarian.\n\n**KV-cache and prefix-cache reset.** A new replica starts with an empty prefix cache, so cluster-wide cache hit rates dip after every scale-out and TTFT rises for repeated system prompts. The countermeasure is cache-aware routing. The Gateway API Inference Extension's Endpoint Picker implements an approximate prefix index, matching request chunks to the replicas most likely to hold that prefix, and combines prefix affinity with queue length and KV-cache load so you do not overload the warm replica. At smaller scale, session affinity in your gateway achieves a crude version of the same thing.\n\n**Node availability.** Pod autoscaling does nothing if the provider has no GPUs of that type in your region. Diversify instance types in the NodePool so Karpenter can retry, and reserve or purchase your baseline capacity outright. In the GCC this is a real planning constraint, not a footnote: local GPU supply shapes what your autoscaler can actually do.\n\n**Scale-to-zero.** KEDA can take a deployment to zero replicas and re-activate it on the first request. That is excellent for overnight batch and internal tools, and usually unacceptable for user-facing chat, where the first caller pays the entire cold start. Set `minReplicaCount` per model according to its SLO, not cluster-wide.\n\n**Metric drift.** Verify metric names against your deployed vLLM version after every upgrade, and alert on `vllm:admission_rejections_total` alongside queue depth so you see requests being refused, not just delayed.\n\n`DCGM_FI_DEV_GPU_UTIL` or `vllm:num_requests_waiting` first stays positive. Set your queue trigger at roughly half that saturation point and your latency guardrail just under your SLO.`ScaledObject` above with your measured values, and confirm KEDA created the backing HPA.\nOur team in the UAE does exactly this work: we design, build and run the platform your models sit on, from GPU nodes and Kubernetes to the gateway and the autoscaling policy. Azrty's [Kuvryn AI](https://www.azrty.com/software/kuvryn-ai) runs your models and GPUs as a service on your own infrastructure, with each team in its own space, and our [AI infrastructure](https://www.azrty.com/services/operate) practice covers the assessment, the build and the ongoing operation. If your vLLM fleet is scaling on the wrong signal, that is a measured, fixable problem.\n\n*Originally published on [Azrty](https://www.azrty.com/blog/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu-utilisatio).*", "url": "https://wpnews.pro/news/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu", "canonical_source": "https://dev.to/azrty/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu-utilisation-566a", "published_at": "2026-12-04 05:08:48+00:00", "updated_at": "2026-12-04 05:15:15.342623+00:00", "lang": "en", "topics": ["ai-infrastructure", "mlops", "large-language-models", "ai-tools"], "entities": ["vLLM", "Kubernetes", "KEDA", "Karpenter", "NVIDIA", "Amazon EKS", "Google Kubernetes Engine", "DCGM"], "also_reported_by": [], "takeaway": "Scale vLLM on Kubernetes using queue depth (vllm:num_requests_waiting, e.g. >25 waiting per pod for 30-60s) as the primary trigger, with p95 TTFT (>2s) and KV-cache usage as guardrails, rather than DCGM_FI_DEV_GPU_UTIL, which stays near 100% across request rates.", "recommendation": {"advice": "Replace GPU-utilisation HPA triggers with vLLM queue depth as the primary signal plus p95 latency and KV-cache guardrails, and set thresholds from a real load test.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu", "markdown": "https://wpnews.pro/news/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu.md", "text": "https://wpnews.pro/news/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu.txt", "jsonld": "https://wpnews.pro/news/autoscaling-llm-inference-on-kubernetes-with-vllm-stop-scaling-on-gpu.jsonld"}}