From Ollama to Kubernetes Production Inference¶
Ollama is well suited for confirming whether a model can run and whether prompt templates and API calls are correct, but the goal of a production migration is not to "put an Ollama container into a Pod" — it is to preserve the application contract while replacing it with a scalable, observable, and governable inference data plane.
1. Migration Path¶
English rendering — the original text is retained below.
Ollama local validation
→ Pin model Revision, Tokenizer, and Prompt Template
→ Export OpenAI-compatible API contract and regression set
→ vLLM/SGLang single-node retest
→ Build immutable image and model artifacts
→ Kubernetes GPU Deployment/ServingRuntime
→ Gateway, authentication, rate limiting, and canary
→ Load testing, failure drills, and SLO
2. What to Preserve from the Local Phase¶
- The model name must not be just the Ollama alias; record the upstream repo and revision;
- Save the Modelfile, system prompt, chat template, quantization format, and context length;
- Build an API regression suite covering streaming, tool calling, stop tokens, and error inputs;
- Record time to first token, generation speed, peak memory, and output differences on the target hardware.
3. Single-Node Re-testing Before Production¶
Load the same model with the target production engine and confirm tokenizer, chat template, stop token, sampling parameters, structured output, and tool calling behavior. The fact that the APIs are both called /v1/chat/completions does not mean their semantics are fully identical.
4. Minimal Kubernetes Closed Loop¶
At minimum, include: GPU resource requests, read-only model mounts, startup/readiness/liveness probes, sufficient /dev/shm, graceful termination, PDB, NetworkPolicy, ServiceAccount, logs, and engine metrics. Readiness must be false until model loading is complete.
5. Release Gates¶
- Regression suite quality passes;
- TTFT/TPOT meet targets under the target concurrency;
- Cold start and model download stay within budget;
- After SIGTERM, stop accepting new requests and drain;
- New and old models support canary deployment and fast rollback;
- The gateway can identify tenant, model, token, and streaming cancellation.
Further reading: Local Running, Inference Engine, Gateway, GPU Platform Experiments