Eighth and final phase of Arc 4. Model serving as a control loop.

Phase 37 trained models. This phase serves them. KServe is the K8s-native model serving layer: InferenceService is the CRD, KServe controllers reconcile it into the underlying Deployment + Service + Ingress + autoscaler + observability. By phase end basecamp serves models via the same operator-pattern that runs everything else: declare a CRD, the operator handles the rest.

This closes Arc 4. basecamp substrate + forge + ascent + beacon + crag are alive. The ML platform (data, training, serving) runs end-to-end. Arc 5 builds the AI tier (prism, loom, warden, vantage) on top.


Prerequisites

  • Phase 37 complete; KubeRay operational
  • At least one model trained + registered in MLflow

Why this phase exists

Serving is where ML meets reality. The model that worked in your notebook needs to: respond in milliseconds, scale with traffic, version cleanly, deploy safely (canary), observe itself. KServe handles all of this via the standard K8s-native pattern. Roll-your-own FastAPI works until traffic grows; then you reinvent KServe poorly.


The pattern-first frame

Same eight steps.


1. PROBLEM

You have a registered model in MLflow. You want it deployed: behind an HTTP endpoint, scaling with traffic, version-aware (current + canary), observable (latency, error rate, throughput), failure-tolerant (retries, fallback). And you want to do this declaratively, K8s-native.

That’s the model serving problem. KServe is the K8s-native answer. BentoML, Triton, Seldon Core are alternatives.


2. PRINCIPLES

2.1 Model serving as a control loop

A KServe InferenceService CRD declares what model + which framework + scaling profile + canary split. The KServe controller reconciles it into the deployed state.

→ Pattern: model-serving: OUTLINE this phase (deepens through Arc 5 LLM serving)

Investigate:

2.2 Inference shapes: sync, batch, streaming

Different serving patterns: synchronous (low latency, per-request), batch (offline, throughput-optimized), streaming (continuous, async).

→ Pattern: inference-shapes

Investigate:

2.3 Scale-to-zero + Keda integration

KServe + Keda: when traffic is zero, replicas scale to zero. When a request arrives, Keda scales up. Cost-efficient for sporadic workloads.

→ Pattern: serverless-inference

Investigate:

2.4 Canary deploys for models

Models change frequently. Canary deploys (5% traffic to v2, 95% to v1) let you validate new versions in production before full rollout. Flagger (K8s-native) automates this.

→ Pattern: canary-deploys (general infrastructure pattern, applied to models)

Investigate:

2.5 Observability for ML services

Beyond RED + USE: prediction distribution, feature drift, model staleness, prediction-latency percentiles.

Investigate:

2.6 Framework support

KServe supports PyTorch (TorchServe), TensorFlow, sklearn, XGBoost, LightGBM, HuggingFace, ONNX, MLflow models, custom. The runtime is pluggable via ServingRuntime CRDs.

Investigate:


3. TRADE-OFFS

DecisionOptionsCost
Serving frameworkKServe; BentoML; Seldon Core; raw FastAPI; Triton Inference ServerKServe: K8s-native CRDs (recommended). BentoML: model-packaging-first. Seldon: similar to KServe. FastAPI: simplest, no autoscale. Triton: NVIDIA-optimized.
AutoscalerKeda (scale-to-zero); HPA (Horizontal Pod Autoscaler); Karpenter (node-level)Keda: event-driven (recommended for sporadic inference). HPA: metric-driven. Karpenter: complementary, node level.
CanaryFlagger; Argo Rollouts; manualFlagger: K8s-native, automated. Argo Rollouts: more controls. Manual: error-prone.
Model package formatMLflow model; ONNX; SavedModel (TF); TorchScriptMLflow: portable. ONNX: cross-framework. SavedModel/TorchScript: framework-specific.

4. TOOLS (as of 2026-06)

K8s-native stack

Reading


5. MASTERY: Model serving alive on basecamp

[ ] KServe installed via Flux + Helm
[ ] Deploy an InferenceService for an MLflow-registered model from Phase 37
[ ] Test inference via curl; verify response shape
[ ] Configure Keda ScaledObject for scale-to-zero on the InferenceService
[ ] Verify cold-start behavior: idle → request → spin-up → response
[ ] Install Flagger; configure a canary policy for the InferenceService
[ ] Deploy a v2 of the model; observe canary rollout
[ ] Add Prometheus metrics: per-model latency, throughput, error rate
[ ] Add a drift-detection job (Spark or simple script) checking prediction distribution
[ ] Integrate with Cilium NetworkPolicy: only specific callers can hit the InferenceService
[ ] Add Triton as a custom runtime for one performance-critical model

6. COMPARE: BentoML or Triton standalone

Pick one:

400-word reflection.


7. OPERATE


8. CONTRIBUTE


What ships from this phase


Validation criteria

[ ] KServe operational with at least one InferenceService running
[ ] Keda scale-to-zero working
[ ] Flagger canary tested
[ ] Drift detection in place
[ ] All 11 operational depth checks
[ ] Compare reflection (400 words)
[ ] 4-5 serving runbooks
[ ] 2-3 ADRs
[ ] Pattern entries:
    - model-serving → OUTLINE
    - inference-shapes → OUTLINE
    - serverless-inference → OUTLINE
    - canary-deploys → OUTLINE (general infra)
    - operator-pattern reinforced
[ ] Exit Test passed
[ ] Arc 4 Final Exam prep can begin

Exit Test

Time: 2.5 hours.

Part 1: Build (90 min)

Deploy a new InferenceService for a different model from MLflow registry. Configure scale-to-zero. Verify cold-start path works.

Part 2: Diagnose (45 min)

A serving scenario (e.g., “InferenceService stuck Ready=False after deploy”). Possible: model artifact missing; framework runtime mismatch; resource limits; storage backend not accessible.

Part 3: Articulate (15 min)

~400 words: “Defend KServe over a hand-rolled FastAPI + Kubernetes Deployment for basecamp’s model serving. Cite the K8s-native ecosystem composition and the control-loop pattern.”


Anti-patterns

Anti-patternWhy
Raw FastAPI for production model servingYou reinvent KServe poorly; missing autoscale, canary, observability
Scale-to-zero on latency-critical workloadsCold-start is unacceptable for some SLOs
Canary without drift detectionWrong-model gets promoted because traffic-error-rate looks fine
Custom Python serving code instead of standard runtimesYou miss Triton/TorchServe perf optimizations
No NetworkPolicy on servingAnyone in the cluster can hit your endpoint

Patterns touched this phase


→ Next: Arc 4 Final Exam