Project: build a production LLM serving stack on Kubernetes
A multi-week portfolio brief: deploy an LLM engine on Kubernetes behind a gateway with authentication and per-tenant limits, autoscale it on queue depth, instrument it with metrics, logs and traces, define SLOs with burn-rate alerts, ship a new version with a canary, load test it, and run a game day with a written postmortem. A laptop version works without a GPU. Milestones, rubric and the questions reviewers ask.
By Sandip Maity, Applied AI Engineer
Key takeaways
- The stack is judged on how it behaves when things go wrong: overload, a bad rollout, a dead replica. Build the tests for those, not only the happy path.
- Autoscale on what predicts latency for an LLM engine (waiting requests or KV cache usage), not on CPU or GPU utilisation.
- SLOs need burn-rate alerts that page on fast and slow budget burn, and a dashboard that shows the same numbers.
- A canary compares the new version with the old one on the same traffic and rolls back automatically on a metric, not on a feeling.
- Everything in Git: manifests, dashboards, alerts and the runbook. A reviewer should be able to rebuild the stack from the repository.
Goal: build and operate a small but complete LLM serving platform, then prove it behaves well under overload, a bad release and a failed replica. The deliverable is a repository that rebuilds the whole stack, a set of test results, and a postmortem from a game day you ran yourself.
You need: Docker, kubectl, kind or another local Kubernetes, Helm, and four to eight weeks part-time. The laptop version runs llama.cpp with a small model on CPU, as in the laptop cluster lab. The GPU version uses vLLM on one or two rented GPU nodes. Background: Serving AI in Production, especially deploying vLLM on Kubernetes, metrics and dashboards, SLOs and alerting and CI and canaries.
Honest limits. A laptop cluster shows the design and the operations, not GPU performance. Do not report throughput or latency from the laptop as if they described a GPU deployment. If you also run the GPU version, keep the two sets of numbers apart and label them.
#The brief
Serve one model to two tenants through a gateway, with SLOs you define, and show the stack handling four situations: normal load, a traffic spike, a bad release and a lost replica.
flowchart LR T1[Tenant A] --> GW T2[Tenant B] --> GW GW[Gateway<br/>auth, per-tenant limits,<br/>timeouts] --> SVC[Engine service] SVC --> R1[Replica 1] SVC --> R2[Replica 2] SVC -.canary 5%.-> RC[Canary replica] R1 & R2 & RC -->|/metrics| PROM[Prometheus] PROM --> GRAF[Grafana<br/>dashboards] PROM --> AM[Alertmanager<br/>burn-rate alerts] PROM --> AS[Autoscaler<br/>on waiting requests] AS --> SVC GW & R1 -->|traces| OTEL[OpenTelemetry<br/>collector]
#Minimum version
- Engine deployment. The engine as a Kubernetes Deployment with resource requests, readiness and liveness probes that mean something (ready only after the model has loaded), a graceful shutdown that drains in-flight streams, and the model weights cached so a restart does not download them again (packaging models).
- Gateway. An OpenAI-compatible gateway in front: API keys per tenant, per-tenant rate and token limits, request timeouts, a maximum prompt length, and an HTTP 429 with
Retry-Afterwhen a limit is hit. Use an existing gateway or write a small one; either way, say why (gateways, routing and failover, multi-tenancy and quotas). - Observability. Prometheus scraping the engine and the gateway; a Grafana dashboard with request rate, TTFT and inter-token latency percentiles, errors, waiting and running requests and KV cache usage per replica; structured JSON logs with a request ID that appears in the gateway and the engine; traces for the request path (tracing with OpenTelemetry).
- SLOs and alerts. Two SLOs, for example 99% of requests with TTFT under 2 s and 99.5% of requests without a server error, each over 28 days. Multi-window burn-rate alerts for each. A runbook entry for each alert in the repository.
- Autoscaling. Scale the engine on waiting requests per replica (KEDA with a Prometheus trigger, or a custom-metrics HPA), with a minimum replica count and a scale-down delay. Measure how long a new replica takes from scale decision to first served request (autoscaling policies, cold starts).
- Canary releases. A way to send a share of traffic to a new version (a second Deployment and weighted routing, or Argo Rollouts), an automatic comparison of TTFT and error rate against the stable version, and automatic rollback on a threshold.
- Everything as code. Manifests or Helm charts, dashboards as JSON, alert rules, and a
make upthat builds the whole stack from an empty cluster (GitOps).
The rest is Pro
Keep reading this full lab
Pro unlocks this full lab, every advanced lesson, the hands-on labs and completion certificates.
One year
$25
365 days, no auto-renewal
Lifetime Best value
$75
pay once, keep it forever
7-day refund, no questions asked. One payment, no auto-renewal.Compare plansHave a licence key?
Not ready? Keep learning free
Free lessons from Portfolio Projects, no sign-up. Or follow the free roadmap →
Not ready? Take the free 5-day email course
One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.
Still to come in this lab
- The four tests
- Game day and postmortem
- Stretch goals
- Milestones
- Rubric
- What a reviewer will ask you
- Checklist
- Where to go next
You will be able to answer
- Which signal is the best trigger for scaling out LLM replicas?
- Why do burn-rate alerts use two windows, such as 1 hour and 5 minutes?
- Your canary gets 5% of traffic. Its p99 TTFT is 30% worse than the stable version. What should happen?
- Why is a cold start a bigger problem for LLM autoscaling than for a typical web service?