Sub topic 1
Why Serving Models Needs More Than a Deployment
Prerequisites
This chapter assumes you understand Kubernetes pods, Deployments, Services, and namespaces. You should also be able to apply YAML with kubectl, read basic HTTP and JSON requests, and understand that a trained model must be loaded before it can answer predictions.
A Kubernetes Deployment answers a narrow question: which container replicas should run? That is useful for model serving, but it does not define how a model is loaded, how clients send prediction requests, or how a new model version replaces an old one.
A model server can run inside an ordinary Deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: model-server
spec:
replicas: 2
selector:
matchLabels:
app: model-server
template:
metadata:
labels:
app: model-server
spec:
containers:
- name: server
image: example/model-server:1.0
ports:
- containerPort: 8080This starts two containers, but several important details remain your responsibility:
- The image must contain the model server and model-loading code.
- The server must know where to find model artifacts.
- The application must expose a consistent inference API.
- Readiness must mean “the model can answer requests,” not merely “the process is running.”
- Scaling must use a useful signal, such as concurrent requests.
- New versions need controlled traffic movement and rollback.
- Logs, metrics, and failures need model-serving context.
KServe adds these model-specific responsibilities through Kubernetes custom resources. A custom resource is an API object that extends Kubernetes with a domain-specific declaration. KServe’s main custom resource is an InferenceService. It describes the desired serving state, while KServe controllers create and coordinate the underlying Kubernetes resources.
What KServe adds
KServe separates the serving system into cooperating parts:
- The control plane watches
InferenceServiceobjects and reconciles the requested state. - A serving runtime loads a particular model format and exposes an inference endpoint.
- A storage initializer copies or downloads model artifacts before the runtime starts.
- A networking layer routes requests to the correct model revision.
- An autoscaler changes replica counts according to request load.
- Optional transformers perform input validation, preprocessing, or response formatting.
This separation lets you describe a model using its format and location instead of rebuilding an application image for every model version. The runtime can also report readiness only after loading succeeds.
A Deployment still exists underneath many KServe deployments. KServe does not replace Kubernetes scheduling, networking, or containers. It supplies a model-serving contract and automates the resources needed to honor that contract.
The practical boundary
Use a plain Deployment when you need full control over a custom application and are willing to implement model loading, health checks, request handling, scaling, and rollout logic yourself.
Use KServe when the workload benefits from standard inference protocols, model storage conventions, autoscaling, revision management, or reusable serving runtimes. KServe is especially useful when several teams serve different model formats through one Kubernetes platform.
The trade-off is another control plane and its configuration. You must operate KServe, its compatible networking components, and its runtime images. In return, model-serving behavior becomes declarative and consistent.
Exercise
Why can a healthy Kubernetes Deployment still fail to provide a usable model endpoint?
Show answer
Its containers may be running even though the model failed to load, the endpoint uses an incompatible request format, readiness is too shallow, or scaling and routing behavior are not configured for inference traffic.