Running LLMs on Kubernetes means running a model server as a GPU workload and then adding what a normal web service doesn't need: GPU-aware scheduling, autoscaling on queue depth instead of CPU, staged rollouts checked against an evaluation set, and per-request latency and token-cost metrics. Self-host only when data rules, steady high volume or the need to control the model outweigh the extra on-call work.
Why are platform teams being asked to run LLMs on Kubernetes?
Most companies already run production on Kubernetes, and model inference is moving there too.
The CNCF's 2025 Annual Cloud Native Survey found that 82% of container users run Kubernetes in production. It also found that 66% of organizations that host generative AI models use Kubernetes for some or all of their inference. The CNCF also points out that only 7% of organizations deploy AI models daily. So hosting a model is common, but running it as a routine service is not.
The request usually reaches the platform team for one of these reasons:
- Data rules. Prompts carry customer or regulated data that can't go to a third-party API.
- Cost at volume. The token bill for one high-traffic feature has grown large enough that finance wants a comparison.
- Model control. A team needs an open-weight or fine-tuned model, a fixed version, or predictable latency.
When should we self-host a model instead of calling a managed API?
Self-host when a hard requirement outweighs the cost of owning GPUs and on-call. That requirement is usually where the data may go, steady high volume, or a model you must control. Otherwise, use a managed API.
| Factor | Managed API | Self-hosted on Kubernetes |
|---|---|---|
| Data handling | Provider's terms and regions | Stays inside your cluster and network |
| Cost shape | Per token, rises with usage | GPU hours, paid whether busy or idle |
| Model choice | Provider's catalogue | Open-weight, fine-tuned, pinned versions |
| Operational load | Provider runs it | You own drivers, scaling, upgrades, on-call |
Decide in this order. First, check whether an open model you could host passes the same evaluation set as the API model. If it doesn't, the rest of the comparison doesn't matter. We explain how to build that set in choosing the best LLM for enterprise applications. Next, work out your break-even point: GPU cost per hour divided by the tokens per hour you actually serve at realistic utilization. Compare that with the API's price per token. Idle GPUs are the usual reason self-hosting turns out to cost more than expected.
Decision path for a managed API versus a self-hosted model on Kubernetes
How do we schedule GPU workloads on Kubernetes without wasting capacity?
Treat GPUs as scarce, whole units. Give them their own node pools, set explicit limits, and share a GPU only where the isolation is good enough for the workload.
In the classic device-plugin model, GPUs are extended resources. Kubernetes schedules them from limits: if you set both a request and a limit they must be equal, and GPUs can't be overcommitted. In practice:
- Separate GPU node pools with taints, so only model servers with matching tolerations land on expensive nodes.
- One standard way to install drivers and the device plugin across nodes, such as NVIDIA's GPU Operator, so node images don't drift apart.
- Pick a sharing mode for each workload. The GPU Operator supports time-slicing to oversubscribe a GPU, but time-sliced workloads share memory with no isolation, so a crash can affect every workload on that GPU. Multi-Instance GPU (MIG) gives you hardware partitions instead, and combined with time-slicing it can run up to seven isolated workloads per GPU. Use whole GPUs for production LLMs, MIG for small models, and time-slicing for development.
- Plan for Dynamic Resource Allocation (DRA). DRA reached GA in Kubernetes 1.34 and is always on from 1.35. It lets pods request GPUs by attribute rather than integer count. Support from drivers and managed Kubernetes services still varies, so check yours.
- Cache model weights on the node or on a fast volume. Downloading tens of gigabytes every time a pod starts wastes GPU time.
How do we autoscale model servers when requests are long and bursty?
Scale on signals from the model server, such as queue depth, requests in flight and KV-cache usage, rather than CPU. Keep some capacity warm, because a new replica can take minutes to load its weights.
CPU-based autoscaling doesn't work here. The work happens on the GPU, a streamed answer can hold a connection for many seconds, and traffic comes in bursts. What works better:
- Scale on waiting requests and latency. Expose the server's queue length and time to first token, and send them to the Horizontal Pod Autoscaler through a custom-metrics adapter or KEDA.
- Account for cold starts. A new node, image pull and weight load add up to minutes. Keep at least one or two replicas warm for interactive traffic, and scale to zero only for batch or internal jobs.
- Route by load, not round-robin. Two requests can differ in cost by orders of magnitude. The Gateway API Inference Extension is an official Kubernetes project. It turns gateways such as Envoy Gateway, kgateway and GKE Gateway into inference gateways that choose a pod using metrics from the model servers and that respect serving priority. The Kubernetes team's announcement explains the endpoint-picker design.
- Separate interactive and batch traffic into different pools or priorities, so overnight summarization jobs don't slow down live chat.
How one request is routed to a model server and how load metrics feed routing and autoscaling
How do we roll out a new model or prompt version without breaking users?
Treat a change to the model, prompt or serving engine like a code release. Run it against the evaluation set, then shadow traffic, then a small canary, and promote it only when quality, latency and cost all hold.
- Version everything together. Store the model weight digest, server image, prompt template and sampling settings in Git, and deploy them through the same pipeline as your other services. Our DevOps engineering practice builds pipelines like this.
- Run offline evaluation first. Score the candidate on questions drawn from real user traffic. In our generative AI work, we write that evaluation set before choosing a model or prompt, and we run it on every change.
- Shadow traffic. Copy live requests to the candidate, compare its answers and latency, and return nothing to users.
- Canary. Send a small share of traffic through weighted routes at the gateway, with rollback limits agreed in advance.
- Budget GPU headroom. During a canary both versions need GPUs, so reserve that capacity before you start.
Lifecycle of one model or prompt version from candidate to production or rollback
What should we monitor for an LLM service: latency, token cost, errors and quality?
Monitor every request on four fronts: latency split into first token and later tokens, token counts mapped to cost, errors and saturation, and answer quality on sampled traffic.
The OpenTelemetry GenAI semantic conventions give standard names for most of these. Time to first token measures time spent in the queue plus the prefill phase. The conventions are still in Development status, so expect some names to change.
| Signal | What it tells you | Example source |
|---|---|---|
| Time to first token | Queueing and prompt processing | gen_ai.server.time_to_first_token |
| Time per output token | Generation speed | gen_ai.server.time_per_output_token |
| Input and output tokens per tenant | Cost and who drives it | gen_ai.client.token.usage |
| Errors, timeouts, rejected requests | Availability | Gateway and server logs |
| GPU memory, utilization, KV cache | Saturation and wasted capacity | GPU exporter metrics |
| Evaluation score on sampled answers | Quality drift | Scheduled evaluation job |
To get cost per request, divide the GPU node cost by the requests served in the same period, then split it across tenants by token share. Base SLOs on what users notice, for example time to first token on interactive requests, rather than raw GPU utilization. Our observability and SRE team sets SLOs on that basis and instruments services with OpenTelemetry.
How do we keep model endpoints secure, with access control and data handling?
Put the model behind the same gateway, identity and network controls as any internal API. Then add controls specific to LLMs for prompts, outputs and logs.
- No direct access to model pods. Use deny-by-default NetworkPolicies so that only the gateway can reach model server pods.
- Identify every caller. Use workload identity or mTLS, and set rate limits and token quotas per tenant.
- Control the model supply chain. Pull weights and images from an internal registry, pin them by digest, and scan images before deploying.
- Decide what gets logged. Prompts and outputs contain user data. Redact personal data, set retention periods, and keep raw prompts out of default logs.
- Check inputs and outputs. Add prompt-injection checks, topic limits and refusal paths. For retrieval, enforce the user's permissions at query time.
- Isolate sensitive tenants in their own namespaces and, if needed, their own GPU node pools.
What does a first production LLM deployment look like in the first 30 days?
Choose one use case, one model and one SLO. Spend the month proving the whole path works before you add more models.
The plan below holds up because each week ends with a check. Week 1 ends when the open model passes the evaluation set and the cost model beats the API at your expected volume. If it doesn't, stop and use the API. Week 2 ends when one request can be traced from gateway to GPU. Week 3 ends when a load test with real prompt lengths meets the SLO and the security review signs off. Week 4 ends with a go or no-go decision based on canary results, with a runbook and an on-call rota in place.
A 30-day plan for the first production LLM deployment on Kubernetes
Conclusion
Kubernetes can run LLMs well, but only once GPUs, autoscaling, rollouts, monitoring and security are set up with these workloads in mind. Start with the self-host decision, and prove it with your own evaluation set and real cost figures before you buy capacity. Calidad's DevOps, observability and generative AI engineers work inside your team. We start with a paid pilot: one pod, one outcome, success criteria agreed up front.
Talk to an engineering lead → https://calidadinfotech.com/contact-us
Frequently asked questions
Can we run an LLM on Kubernetes without GPUs?
Small, quantized models can run on CPU for low-volume internal tasks. Most interactive production workloads need GPUs to meet a reasonable time-to-first-token target. Test on CPU against your evaluation set and latency SLO before ruling it in or out.
Do we need a dedicated model-serving platform, or is a plain Deployment enough?
For one model, a Deployment behind an inference-aware gateway is often enough. A serving layer becomes worth it when you run several models or versions and need repeatable canaries, scale-to-zero and shared monitoring. Add it when the second or third model arrives, not before.
How many GPUs do we need for our first model?
That depends on model size, precision, context length and concurrency. GPU memory has to hold both the weights and the KV cache for requests in flight. Run a load test with real prompt lengths and peak concurrency, then add headroom for canaries and cold starts.
How do we compare self-hosted cost with managed API pricing?
Divide the hourly cost of your GPU nodes by the tokens per hour they actually serve at realistic utilization, then compare that with the API's price per token. Include engineering and on-call time. Use measured utilization, not peak throughput, because idle GPUs still cost money.
Should training and inference share the same cluster?
They can, but put them in separate GPU node pools with priority classes, because inference is latency-sensitive and training jobs are not. Otherwise a long training job can take GPUs that live traffic needs during a burst.
This article first appeared on Calidad Infotech.
