Scale to Zero and Back Up
Save cost with request-driven autoscaling.
Scale to Zero and Back Up is a free MLOps Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MLOps Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Idle Models Cost Money
A model pod sitting with no traffic still burns CPU, memory, and cloud bills. KServe can shrink an idle service all the way down. Scale to zero stops that waste. 💸
Powered by Knative
KServe's serverless mode rides on Knative, which watches request volume and adjusts replicas. When traffic stops, it can remove every pod for that service.
Request-Driven Autoscaling
Replicas track demand, not a fixed schedule. As requests rise, KServe adds pods, and as they fade it scales back. This is request-driven autoscaling in action.
Setting minReplicas to Zero
To allow full scale down, you set minReplicas to 0 in the predictor spec. With zero allowed, an idle service drops to no running pods at all.
spec:
predictor:
minReplicas: 0
model:
modelFormat:
name: sklearnThe Concurrency Target
The autoscaler aims for a target number of in-flight requests per pod. This concurrency target decides how aggressively KServe adds replicas under load.
metadata:
annotations:
autoscaling.knative.dev/target: "10"Scaling Back Up
When a request arrives at a zero-scaled service, Knative spins a pod up on demand. Traffic resumes the moment the pod is ready, so the scale up is automatic.
The Cold Start Cost
That first request after zero must wait for the pod to start and load the model. This delay is the cold start, the main trade-off of scaling to zero. ⏱️
When Zero Makes Sense
Scale to zero shines for bursty or rare workloads where idle time dominates. For steady, latency-critical traffic, the cold start penalty may not be worth it.
Keep One Warm Instead
If cold starts hurt, set minReplicas to 1 so one pod always stays alive. You trade a little cost for a guaranteed warm instance ready to serve.
spec:
predictor:
minReplicas: 1Cap the Upper End
You can also bound growth with maxReplicas so a traffic spike never overruns your cluster budget. It puts a ceiling on the autoscaler.
spec:
predictor:
minReplicas: 0
maxReplicas: 5Watch It Scale
You can confirm the behavior by watching pods appear and vanish with traffic. The pod count drops to zero when idle and climbs back when calls come in.
kubectl get pods -l serving.kserve.io/inferenceservice=sklearn-iris -wQuick Check
What is the main downside of letting a service scale to zero?
Recap
You saw how minReplicas: 0 lets KServe scale idle models to zero and back on demand. Cap with maxReplicas, and keep one warm if cold starts hurt. Great progress! 🎉
Frequently asked questions
Is the “Scale to Zero and Back Up” lesson free?
Yes — the full text of “Scale to Zero and Back Up” is free to read here on the web, and the MLOps Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MLOps Academy course, upgrade to CoddyKit PRO.
What will I learn in “Scale to Zero and Back Up”?
Save cost with request-driven autoscaling. You practise MLOps Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start MLOps Academy?
No prior experience is required. MLOps Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Scale to Zero and Back Up” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this MLOps Academy lesson?
Yes. Every MLOps Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The InferenceService Resource
- Scale to Zero and Back Up
- Write a Custom Predictor
- KServe vs Seldon Core