Rolling a new skip model out gradually on KServe 0.21, how do canaryTrafficPercent in Knative mode and spec.canary in Standard mode each roll forward and back?
answer
- one mechanism per deployment mode
- revisions vs named canary predictors
- zero means pin back or dark launch
- promote by removing, or by renaming
- annotation must read Standard
basics
~20 sIn Knative mode, canaryTrafficPercent sends that share to the new revision; removing it promotes, and 0 rolls back to the last rolled-out revision. In Standard mode (0.20+), spec.canary entries get trafficPercent and fixed replicas; renaming promotes, deleting the entry rolls back.
solid answer
~40 sIn Knative mode, change `storageUri` and set `canaryTrafficPercent: 10`. The new revision gets 10% and the last revision rolled out at 100% keeps 90%. Removing the field promotes the new revision, and `canaryTrafficPercent: 0` pins all traffic back to the previous rolled-out revision. Standard mode has no revisions, so since 0.20 it uses a `spec.canary` list. Each entry is a predictor with a required `name` and a `trafficPercent` (0 for a dark launch, total at most 100), runs as its own fixed-replica Deployment, and is accepted only when the `serving.kserve.io/deploymentMode` annotation is `Standard`. You promote by setting the stable `predictor.name` to the canary's name and dropping the entry, and roll back by deleting the entry.
code
yaml · 22 linesapiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: skip-model
annotations:
serving.kserve.io/deploymentMode: Standard
spec:
predictor:
name: v7
minReplicas: 4
model:
modelFormat:
name: xgboost
storageUri: s3://example-skip-models/v7
canary:
- trafficPercent: 10
predictor:
name: v8
model:
modelFormat:
name: xgboost
storageUri: s3://example-skip-models/v8go deeper
Recall that canaryTrafficPercent sets the share for the new model, and that removing it promotes the new model.
Explain the Knative revision bookkeeping (latest ready, latest rolled out, previous) and how a 0 pins traffic back.
Choose the mechanism the service's mode actually supports, know the Standard canary's fixed replicas and annotation rule, and verify the split from status before ramping.
Standardise one rollout path per serving mode so teams do not mix revision splits and named canaries, and keep ramp policy outside the manifest.
## Two canary mechanisms, one per mode KServe 0.21 has **two** ways to send part of an InferenceService's traffic to a new model, and which one you get depends on the deployment mode: | | Knative mode | Standard mode | |---|---|---| | Field | `canaryTrafficPercent` on the component | `spec.canary` list of `CanarySpec` entries | | Since | long-standing | 0.20 | | What the canary is | the latest Knative revision | a separately named predictor with its own Deployment | | Candidates at once | one (latest vs last rolled out) | several, each with `trafficPercent` | | Canary scaling | autoscaled like any revision | fixed replicas, no autoscaling | | Promote | remove `canaryTrafficPercent` | set stable `predictor.name` to the canary's name, remove the entry | | Roll back | `canaryTrafficPercent: 0` | remove the canary entry | How large each step is and how long it bakes is a rollout-design question; KServe only moves the percentage you write. ## Knative mode: canaryTrafficPercent between revisions Every change to a component's spec in Knative mode creates a new revision. KServe tracks the **last revision that was rolled out with 100% of traffic**. To roll out skip model v8: 1. Change `storageUri` to the v8 booster and add `canaryTrafficPercent: 10` under `predictor`. 2. KServe splits traffic: 10% to the new revision (`latestReadyRevision`), 90% to the previous one (`latestRolledoutRevision`). `kubectl get isvc skip-model` shows the split in the `PREV` and `LATEST` columns. A revision that never becomes ready gets no traffic. 3. Raise the percentage in later applies as your ramp plan says. 4. **Promote** by removing `canaryTrafficPercent`: the new revision takes 100% and becomes the rolled-out one; the old revision's pods scale down. 5. **Roll back** by setting `canaryTrafficPercent: 0`: all traffic is pinned to the previous rolled-out revision while the new one stays deployed at 0%. With the annotation `serving.kserve.io/enable-tag-routing: "true"`, KServe also publishes tagged URLs (prefixed `latest-` and `prev-`) so testers can hit one revision directly. KServe's canary pages still say this strategy works "only in serverless deployment mode". That is true of `canaryTrafficPercent`, since Standard mode has no revisions to split between, but stale as a statement about Standard mode, which gained its own mechanism in 0.20. ## Standard mode: the spec.canary list (0.20+) Standard mode has no revisions, so 0.20 added a list next to the predictor: - Each entry holds a full `predictor` with a **required `name`**, which must differ from the stable predictor's name. The canary's Deployment is named `{isvc}-{name}-predictor`. - `trafficPercent` runs 0-100, and the entries together may not exceed 100. A value of **0 is a dark launch**: deployed, warm, receiving nothing. - A canary uses **fixed replicas**: validation rejects `maxReplicas`, `scaleTarget`, `scaleMetric` and `autoScaling` on it, and its `minReplicas` may not exceed the stable predictor's. - Validation refuses `spec.canary` unless the InferenceService's `serving.kserve.io/deploymentMode` annotation is `Standard` (the legacy `RawDeployment` value is rewritten to `Standard` first). On a cluster whose ConfigMap default is Knative, a manifest that relies on the default is rejected with `canary is only supported in Standard deployment mode`. **Promote** without restarting pods by setting the stable `predictor.name` to the canary's name, together with the canary's model, and deleting the entry; the stable predictor then adopts the canary Deployment. A `predictor.name` change with an unchanged `storageUri` is refused, so the model has to move with the name. **Roll back** by deleting the entry; KServe cleans up the orphaned Deployment. A plain spec change in Standard mode, with no canary list, is a Kubernetes rolling update shaped by the component's `deploymentStrategy` or the ConfigMap's `deploymentRolloutStrategy`. That is a rollout of pods, not a traffic split. ## Picking the mechanism for the skip model The skip model runs in Knative mode on this cluster, so `canaryTrafficPercent` is the mechanism it has. A team that wants two candidate boosters at once, say v8 at 10% and v8-lite at 5%, cannot express that with one revision split. It needs a `Standard`-mode InferenceService with two `spec.canary` entries. The mode cannot be edited in place, so that means a new InferenceService. ## What to check before you trust a split - The mode the InferenceService actually runs in (`status.deploymentMode`), not the one you assume. - In Knative mode, the revision names in the status. Rolling back with `0` returns to the **last rolled-out** revision, which is not necessarily the one before the current spec. - In Standard mode, that the canary Deployment is ready before you give it traffic, since it will not autoscale under load.
- In KServe's Knative mode, which revision does canaryTrafficPercent: 0 send traffic back to?To the previous rolled-out revision, the last one that had received 100% of traffic, recorded in the predictor's status. The new revision stays deployed at 0%. If several specs were applied without ever being promoted, the pinned revision is the last fully rolled-out one, not simply the spec before the current one.
- A KServe Standard-mode canary entry sets maxReplicas: 6 so it can absorb load. What happens?Validation rejects the InferenceService: canary entries use fixed replicas and may not set `maxReplicas`, `scaleTarget`, `scaleMetric` or `autoScaling`. Their `minReplicas` may not exceed the stable predictor's. Size the canary for its traffic share before raising `trafficPercent`, or promote it to the stable predictor, which does autoscale.
- How do you send test requests to only the canary revision in KServe's Knative mode?Annotate the InferenceService with `serving.kserve.io/enable-tag-routing: "true"`. KServe then publishes tagged URLs in the component status, prefixed `latest-` for the canary revision and `prev-` for the rolled-out one, so testers can hit either revision directly while the weighted split continues for normal traffic.
- canaryTrafficPercent splits traffic the same way in Standard mode
- canaryTrafficPercent: 0 deletes the new revision
- A Standard-mode canary entry autoscales like the stable predictor
- spec.canary works on any cluster regardless of the deploymentMode annotation
- KServe chooses the ramp steps and bake time on its own
Assumes KServe 0.21; the Standard-mode spec.canary list arrived in 0.20, and older releases could split traffic only with canaryTrafficPercent in Knative (Serverless) mode.