A KServe InferenceService serving a 7B model on GPU nodes keeps one pod running all night with no traffic: which KServe settings stop it scaling to zero?
answer
- a default replica floor
- set per component, not per service
- only one mode can reach zero
- autoscalerClass in Standard mode
- mode is fixed after creation
basics
~20 sIn KServe 0.21, minReplicas defaults to 1 on every component, and only Knative mode can scale to zero. A service in Standard mode runs under an HPA, KEDA or no autoscaler and keeps its pod; zero needs Knative mode plus minReplicas: 0 everywhere.
solid answer
~40 sFirst, `minReplicas` is unset, and KServe defaults it to 1. It must be `0` on the predictor and on any transformer or explainer, since each component scales separately. Second, scale-to-zero exists only in Knative mode, where the Knative Pod Autoscaler scales on `concurrency` by default. If the service runs in `Standard` mode, by annotation or by the ConfigMap's `defaultDeploymentMode`, KServe drives it with `serving.kserve.io/autoscalerClass`: `hpa` by default, or `keda`, `external`, `none`. Its docs list scale-to-zero as unsupported there. The mode cannot be edited on an existing InferenceService, so switching means re-creating it. Keeping one warm pod can be deliberate, because a 7B cold start is slow.
code
yaml · 19 linesapiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: playlist-blurbs
annotations:
serving.kserve.io/deploymentMode: Knative
spec:
predictor:
minReplicas: 0
maxReplicas: 3
scaleMetric: concurrency
scaleTarget: 4
model:
modelFormat:
name: huggingface
storageUri: hf://example-org/blurb-7b-instruct
resources:
limits:
nvidia.com/gpu: "1"go deeper
Recall that minReplicas defaults to 1 and that it must be set to 0 for scale-to-zero.
Explain that each component scales separately, that only Knative mode reaches zero, and which autoscaler each mode uses by default.
Diagnose from status and the created objects (mode, per-component minReplicas, HPA or ScaledObject) and know that switching modes means re-creating the service.
Weigh idle GPU cost against a multi-minute cold start per service, and decide which serving mode the platform offers for LLMs versus small models.
## The symptom A 7B instruction model writes playlist blurbs through a KServe InferenceService on GPU nodes. Nobody calls it overnight, yet one GPU pod keeps running and the GPU node never drains. Several independent KServe settings can each cause this. Check them in order. ## 1. minReplicas defaults to 1 Every InferenceService component has its own scaling fields (`minReplicas`, `maxReplicas`, `scaleMetric`, `scaleTarget`). When `minReplicas` is unset, KServe uses **1** (`DefaultMinReplicas`). KServe's docs say it outright: by default it keeps one replica; set `minReplicas: 0` to let pods scale down to zero when no traffic arrives. This is per **component**. If the blurb service also has a transformer, the transformer keeps its own default of 1 unless you set it too. A CPU transformer pod costs little, but it still means "something is always running". ## 2. Only Knative mode can scale to zero | | Knative mode | Standard mode | |---|---|---| | Autoscaler | Knative Pod Autoscaler (KPA) | `serving.kserve.io/autoscalerClass`: `hpa` (default), `keda`, `external`, `none` | | Default `scaleMetric` | `concurrency` | `cpu` | | Other metrics | `rps` | `memory`, or KEDA's `autoScaling` metrics | | `minReplicas: 0` | scales to zero; Knative holds requests while a pod starts | scale-to-zero not supported, per KServe's docs | So the questions are which mode the service runs in and what `minReplicas` says. The mode comes from the `serving.kserve.io/deploymentMode` annotation, or from the `inferenceservice-config` ConfigMap's `defaultDeploymentMode` when there is none. Teams often put LLM services in `Standard` mode on purpose, since KServe recommends it for LLM workloads and it avoids Knative's queue proxy. When they do, setting `minReplicas: 0` will not make the pod go away. The mode cannot be changed on an existing InferenceService. The webhook rejects the update, so moving the blurb service to Knative means creating a new InferenceService. ## 3. The autoscaler class in Standard mode `serving.kserve.io/autoscalerClass` applies to Standard mode: 1. `hpa`, the default. KServe creates an HPA per component. With no settings, that HPA defaults to `minReplicas` 1, `maxReplicas` 1, `cpu` at 80% utilization, so it never actually scales. 2. `keda`. KServe creates a KEDA ScaledObject from the component's `autoScaling` metrics. Validation refuses the class unless at least one component has an `autoScaling` spec. 3. `external`. KServe deletes its own HPA and leaves scaling to another controller. 4. `none`. KServe creates no HPA at all; the replica count stays where you put it. How the HPA and KEDA objects behave once created belongs to their own material. On this leaf, the KServe point is which object the annotation makes and which field feeds it. ## 4. Keeping one pod can be the right answer For a 7B model, the first request after zero waits for a GPU node (if the node pool also scaled down), the image, the weight download by the storage initializer, and the load onto the GPU. That can take minutes. Whether that cold start is acceptable is a capacity and latency decision, which belongs to the serving-concepts material. KServe's side is mechanical: - To allow zero, run in Knative mode with `minReplicas: 0` on every component. - To keep one warm pod deliberately, leave `minReplicas: 1` and say so in the manifest. - For Standard mode with a predictable daily pattern, scale with KEDA or an external controller, knowing KServe will not take the service to zero. ## Putting it together for the blurb service If the platform team wants the blurb writer off the GPU at night, the KServe changes are: create it, or re-create it, with `serving.kserve.io/deploymentMode: Knative`; set `minReplicas: 0` on the predictor and on any transformer; and pick `scaleMetric: concurrency` with a `scaleTarget` that matches how many generations one pod handles at once. If the team instead keeps it in `Standard` mode for steadier latency, the explanation for the night-time pod is simply that this mode does not go to zero, and the cost belongs in the capacity plan. ## Diagnosis checklist - `status.deploymentMode` on the InferenceService, and the annotation if present. - `minReplicas` on the predictor **and** on any transformer or explainer. - In Standard mode, the `autoscalerClass` annotation and the HPA or ScaledObject KServe created. - In Knative mode, whether the revision still receives requests: an external uptime check that calls the service counts as traffic and keeps a pod warm.
- In a KServe Standard-mode InferenceService, what does the default HPA do when no scaling fields are set?KServe still creates an HPA per component, with `minReplicas` 1, `maxReplicas` 1, `scaleMetric` cpu and a target of 80% utilization. Because minimum and maximum are equal, it never actually changes the replica count. Set `maxReplicas` (and `scaleTarget`) to make it scale, or use `autoscalerClass: none` if you want no HPA at all.
- A KServe InferenceService sets serving.kserve.io/autoscalerClass: keda but no autoScaling block. What happens?Validation rejects it: with the `keda` class at least one component, whether predictor, transformer or explainer, must carry an `autoScaling` spec. Otherwise no ScaledObject could be built and the service would silently run without autoscaling. Add `autoScaling` metrics to the component KEDA should scale.
- KServe scales an idle InferenceService to zero by default
- minReplicas: 0 on the predictor also scales the transformer to zero
- Standard mode reaches zero once minReplicas is 0
- autoscalerClass: hpa applies to Knative-mode services
- Editing the deploymentMode annotation moves a running service to Knative
Assumes KServe 0.21, whose mode names are Knative and Standard (formerly Serverless and RawDeployment) and whose Standard mode picks hpa, keda, external or none by annotation.