Skip to main content

Self-Hosted Open LLM Inference on Kubernetes

A self-hosted open-weight LLM serving platform on Kubernetes using vLLM continuous batching, KServe, and KEDA GPU autoscaling behind an OpenAI-compatible API. It targets data residency and predictable cost at high, steady volume.

Cloud Provider
KUBERNETES
Components
7
Use Cases
3
Standards
6

Overview

Self-hosting open-weight LLMs (such as Llama, Mistral, or Qwen) on your own GPUs gives data residency, predictable cost at high volume, and freedom from per-token vendor pricing. This architecture serves these models on Kubernetes with a high-throughput inference engine and an OpenAI-compatible API so applications can switch with minimal changes. Use it when call volume is high and steady, privacy rules require keeping data in-house, or you need full control over the model.

Components

  • vLLM: the inference engine, using continuous batching and paged attention to maximize GPU throughput.
  • KServe: manages model deployment, versioning, and autoscaling as inference services.
  • KEDA: scales replicas on request queue depth and GPU metrics, including scale-to-zero for idle models.
  • Envoy: ingress that exposes the OpenAI-compatible API, terminates TLS, and load-balances.
  • Redis: a semantic and exact-match response cache to cut redundant generation.
  • MinIO: stores model weights for fast, repeatable loading.
  • Prometheus: tracks tokens per second, latency, and GPU utilization.

Data Flow

A client sends an OpenAI-style request to Envoy, which routes it to a vLLM-backed KServe service for the requested model. vLLM batches concurrent requests dynamically to keep the GPU busy and streams tokens back. Frequently repeated prompts are served from the Redis cache. Weights load from MinIO at startup. Metrics flow to Prometheus, where KEDA reads them to scale replicas up under load or down to zero when idle.

Scaling and Resilience

Continuous batching is the key to GPU efficiency: it packs many requests into each forward pass, raising throughput several-fold over naive serving. KEDA adds and removes GPU pods based on demand, and scale-to-zero saves money on rarely used models. Use node pools with the right GPU types and bin-pack carefully because GPUs are scarce and expensive. Keep warm replicas for latency-sensitive models to avoid slow model loads. Spread replicas across nodes and zones.

Security

Harden container images and apply pod security standards since these workloads run privileged GPU drivers. Authenticate API callers and apply per-tenant quotas at the gateway. Keep weights and prompts inside the cluster with network policies and encryption. Self-hosting is often chosen for privacy, so ensure prompts never leave your environment and logs redact sensitive content. Scan images for vulnerabilities and pin model and dependency versions for reproducibility.

Trade-offs and Alternatives

Self-hosting wins on cost and control at high, steady volume but requires GPU capacity, MLOps skill, and ongoing tuning; managed APIs (Bedrock, OpenAI, Vertex) are simpler and better for spiky or low volume. Open models trail the best closed models on the hardest tasks, though the gap narrows and many workloads do not need frontier capability. GPU scarcity and cold-start latency are real operational challenges. Benchmark cost-per-token and quality on your actual workload before committing.