AI Engineer Portal
Your personal operating system for career transition.
Private mode
Exercise
Generate Kubernetes manifests for an LLM service
Generate Kubernetes Manifests for an LLM Service
Deploying an LLM service to Kubernetes requires careful manifest design. The key differences from a typical web service:
- Slow startup: Even API-gateway-style LLM services can be slow to initialize (loading embedding models, warming caches). The
startupProbemust allow enough time. - Memory sensitivity: LLM services hold large in-memory caches. Pod memory limits need to be generous.
- Config via secrets: API keys must come from Kubernetes Secrets, never plain env vars in the manifest.
- Graceful shutdown: In-flight LLM calls can take 10-30 seconds.
terminationGracePeriodSecondsmust accommodate this.
What to build
Write Python functions that generate Kubernetes manifest dictionaries:
build_deployment(config: ServiceConfig) -> dict— aDeploymentmanifest with startup/liveness/readiness probes, resource limits, secret env vars, andterminationGracePeriodSeconds: 45.build_service(config: ServiceConfig) -> dict— a ClusterIPServicemanifest.build_hpa(config: ServiceConfig) -> dict— aHorizontalPodAutoscaler(autoscaling/v2) targeting 70% CPU utilization.
The startup probe must use failureThreshold: 30 + periodSeconds: 10 (5 minutes total).
Constraints
- Return plain Python dicts (JSON-serializable).
- API keys injected via
secretKeyReffromconfig.secret_name. - Use
apps/v1for Deployment,autoscaling/v2for HPA.
Api Async / hard / Step 13 of 23
Practice stage
Async and provider control
Hint
Make waiting behavior explicit. Timeouts, retries, and concurrency limits matter more than squeezing everything into one helper.
Success criteria
- - Uses async boundaries coherently
- - Makes timeout and retry decisions legible
- - Would be maintainable under provider instability
Review checklist
- - Is timeout behavior explicit?
- - Is retryable failure separate from terminal failure?
- - Would logs reveal what actually timed out?
Related lessons
Practice
Generate a variation
Generate a new exercise variation to deepen understanding or practice a related concept.
Attempt history
Recent submissions
Before you submit, decide what a strong answer should make obvious to the reviewer.
No attempts yet.