KServe
Basic information
Section titled “Basic information”| Item | Value |
|---|---|
| Version | KServe v0.18.0 |
| Official docs | KServe |
| Upstream source | applications/kserve |
Concepts and characteristics
Section titled “Concepts and characteristics”KServe is the model-serving layer responsible for “how a model is launched as Pods, and at which URL it receives prediction requests”. A user normally creates an InferenceService, and the KServe controller turns it into a ServingRuntime, storage initializer, predictor workload, Knative Serving resources, and Istio routing.
The relationship with Knative matters here. In this deployment, inferenceservice-config sets defaultDeploymentMode: Serverless. So KServe does not just create a Deployment directly; it uses Knative Serving Service, Revision, and Route as the runtime underneath. Knative handles revisions, autoscaling, the activator, and route creation, while KServe handles the model-serving API, runtime selection, and predictor composition.
사용자 선언: InferenceService -> KServe controller -> Knative Service / Revision / Route -> predictor Pod / Service / Istio VirtualService -> 외부 serving endpointWhat the component establishes
Section titled “What the component establishes”- KServe API: provides CRDs such as
InferenceService,ServingRuntime,ClusterServingRuntime,InferenceGraph,TrainedModel,LLMInferenceService, andLocalModelCache. - KServe controller:
kserve-controller-managerwatchesInferenceServiceand runtime resources and reconciles predictor workloads. - Serving runtime catalog: provides default
ClusterServingRuntimedefinitions for sklearn, xgboost, huggingface, and others. - Webhook and certificate: installs validation/defaulting webhooks for the KServe CRDs and uses cert-manager certificates and caBundle injection.
- Serverless routing settings:
inferenceservice-configdefines the Knative local gateway, the Kubeflow gateway, the path template, and a serving-specificingressDomain. - models-web-app UI: installs the web app that lists and manages
InferenceServiceresources from the Dashboard/kserve-endpoints/menu.
Taken together, KServe’s core responsibilities are to expose serving APIs, choose serving runtimes per model format, attach the storage-initializer behavior that downloads model artifacts before the predictor starts, integrate with Knative Serving and Istio for request routing and endpoint exposure, and provide the Dashboard-facing models-web-app.
Responsibility split between KServe and Knative
Section titled “Responsibility split between KServe and Knative”| Layer | Responsibility | Main resources |
|---|---|---|
| KServe | model-serving API, runtime selection, predictor spec generation, storage initializer, inference URL settings | InferenceService, ServingRuntime, ClusterServingRuntime, inferenceservice-config |
| Knative Serving | serverless workload lifecycle, revisions, routes, scale-to-zero, activator/autoscaler | Service, Revision, Route, Configuration, activator, autoscaler |
| Istio/Kubeflow gateway | external and internal routing, JWT validation, AuthorizationPolicy | kubeflow-gateway, knative-local-gateway, cluster-local-gateway, VirtualService |
| models-web-app | KServe UI inside the Kubeflow Dashboard | kserve-models-web-application, /kserve-endpoints/ |
The API users see is KServe, but in serverless mode Knative supports the actual workload lifecycle. That is why Knative must be installed first for KServe predictors to come up in serverless mode.
[Reference] sklearn-iris InferenceService
Section titled “[Reference] sklearn-iris InferenceService”When you create an InferenceService like the following, the user creates only one resource, but KServe and Knative create several resources underneath.
apiVersion: serving.kserve.io/v1beta1kind: InferenceServicemetadata: name: sklearn-iris namespace: kubeflow-user-example-comspec: predictor: model: modelFormat: name: sklearn storageUri: gs://kfserving-examples/models/sklearn/1.0/modelIn this example KServe sees modelFormat: sklearn and selects the kserve-sklearnserver ClusterServingRuntime. storageUri is the location of the model artifact. When the predictor Pod starts, the KServe storage-initializer init container downloads the model from this location and places it at a path the runtime container can read. Then kserve-container, based on kserve/sklearnserver:v0.18.0, starts as the model server.
Because this is serverless mode, the KServe controller does not stop at a single Deployment for the predictor; it creates a Knative Service. Underneath it, Knative creates a Configuration, Revision, Route, the revision Deployment/ReplicaSet/Pod, and revision Services.
In short, the controller flow is roughly:
- KServe sees
modelFormat: sklearnand selectskserve-sklearnserveras the runtime. - KServe arranges a storage initializer for
storageUri. - Because
defaultDeploymentModeisServerless, KServe creates a KnativeServicesuch assklearn-iris-predictor. - Knative then creates a
Configuration,Revision,Route, revision Deployment, Pods, and revision Services. - Istio and Knative routing expose the predictor through the repository’s serving host and path conventions.
| Resource | Example name | Created by | Role |
|---|---|---|---|
| InferenceService | sklearn-iris | user / GitOps | model-serving declaration |
| Knative Service | sklearn-iris-predictor | KServe controller | predictor serverless workload declaration |
| Knative Configuration | sklearn-iris-predictor | Knative Serving | manages the desired template and latest ready revision |
| Knative Revision | sklearn-iris-predictor-00001 | Knative Serving | snapshot of a specific predictor spec |
| Deployment | sklearn-iris-predictor-00001-deployment | Knative Serving | runs the revision Pods |
| Pod | sklearn-iris-predictor-00001-deployment-... | Kubernetes Deployment | runs the model server, queue-proxy, and sidecars |
| Service | sklearn-iris-predictor-00001, sklearn-iris-predictor-00001-private | Knative Serving | revision traffic and private traffic endpoints |
| ExternalName Service | sklearn-iris, sklearn-iris-predictor | Knative/KServe routing | points to knative-local-gateway.istio-system.svc.cluster.local |
| VirtualService | sklearn-iris... family | KServe / Knative net-istio | routing for the /serving/<namespace>/<name> path and the internal predictor host |
kubectl get all does not show VirtualService or InferenceService. To see the hierarchy, query the KServe and Knative resources together, for example kubectl get inferenceservice,ksvc,configuration,revision,route,svc,deploy,pod -n <profile namespace>.
Role in Kubeflow
Section titled “Role in Kubeflow”Background
Section titled “Background”Exposing a trained model as an online prediction endpoint in Kubeflow takes more than launching a single Pod. Model artifact download, runtime image selection, request path, autoscaling, authentication and authorization, Dashboard UI, and Profile namespace permissions all have to fit together. KServe bundles these into InferenceService, a user-friendly Kubeflow API.
Key contributions
Section titled “Key contributions”- Model-serving API: users create an
InferenceServicein their Profile namespace, and KServe prepares the predictor endpoint. - Knative serverless integration: the KServe controller creates Knative resources, enabling revision-based rollout and scale-to-zero.
- Profile namespace permission extension:
kubeflow-kserve-admin/edit/vieware merged into Kubeflow aggregated RBAC so users can manage KServe resources in their own namespace. - Dashboard integration: the
KServe Endpointsentry in the Central Dashboard menu links to/kserve-endpoints/. - M2M serving basis: provides the routing basis that lets external backends call the
kserve.10.x.x.x.nip.io/serving/<namespace>/<name>/...endpoint with aplatform-apitoken.
Deployment structure
Section titled “Deployment structure”Overlay layout
Section titled “Overlay layout”KServe applies the controller and models-web-app separately. The controller side has many CRDs and webhooks, so it needs server-side apply. The models-web-app overlay is separate because it is a UI layer rather than part of the reconcile loop.
overlays/dev/kubeflow/overlays/kserve/controller -> applications/kserve/kserve -> kserve_kubeflow.yaml -> kserve-cluster-resources.yaml -> aggregated-roles.yaml -> dev patch: serving 전용 ingressDomain
overlays/dev/kubeflow/overlays/kserve/models-web-app -> applications/kserve/models-web-app/overlays/kubeflow -> base Deployment/Service/RBAC -> istio VirtualService/AuthorizationPolicyController overlay adjustments
Section titled “Controller overlay adjustments”| Adjustment | Target | Reason |
|---|---|---|
| Fix caBundle annotations | KServe CRDs and webhook configs | upstream annotations point to kserve/<cert>, but the certificate is in the kubeflow namespace |
| Fix certificate SANs | serving-cert, llmisvc-serving-cert, localmodel-serving-cert | webhook Service DNS is *.kubeflow.svc, so the SANs must also be based on kubeflow |
| Remove localmodel node agent DaemonSet | kserve-localmodelnode-agent | avoid privileged, hostPID, and hostNetwork usage |
Add RuntimeDefault seccomp | KServe controller deployments | strengthen the PodSecurity baseline |
Remove insecure LLMInferenceServiceConfig | LLMInferenceServiceConfig resource | remove configurations with unnecessary capabilities and non-root violations |
Remove LLMInferenceServiceConfig validating webhook | llminferenceserviceconfig.serving.kserve.io | that webhook server does not exist, so it can produce EOF validation errors |
| Path-based routing setting | inferenceservice-config | KServe generates /serving/<namespace>/<name> URLs automatically |
| Serving-specific domain setting | ingressDomain: kserve.10.x.x.x.nip.io | prevents host collision between the Dashboard and VirtualServices |
models-web-app overlay
Section titled “models-web-app overlay”models-web-app is a UI, not the KServe controller. It is linked into the Dashboard under the /kserve-endpoints/ path and uses USERID_HEADER=kubeflow-userid to identify the current user. Its RBAC includes InferenceService, InferenceGraph, and TrainedModel, plus read access to Knative Serving Service/Route/Configuration/Revision.
There is also an important limitation. models-web-app is an InferenceService-centered UI and does not support creating LLMInferenceService. The error unsupported resource serving.kserve.io/... LLMInferenceService comes from the models-web-app allowlist, not from the KServe API server or controller. LLMInferenceService must be created directly with kubectl apply instead of the UI, and you should not expect to view or manage it in the Dashboard either.
models-web-app API calls and CSRF
Section titled “models-web-app API calls and CSRF”models-web-app is not a static frontend that only serves a browser UI. Under /kserve-endpoints/api/... it also provides backend routes that act as a Kubernetes API proxy. For example, POST /kserve-endpoints/api/namespaces/<namespace>/inferenceservices takes the InferenceService manifest in the request body and calls api.create_custom_rsrc, which performs a SubjectAccessReview based on the user identity and then creates the Kubernetes custom object with the web app’s ServiceAccount. Therefore a backend or CI job without a local kubeconfig or KServe Python client permissions can create an InferenceService by calling the models-web-app API through the gateway.
Authentication and CSRF need to be considered separately here. If an Authorization: Bearer <token> header is present, the gateway skips the oauth2-proxy CUSTOM path, and the m2m-token-issuer RequestAuthentication validates the token and produces the kubeflow-userid header. However, the models-web-app backend uses the common Kubeflow crud_backend, so it additionally performs a double-submit CSRF check for non-safe methods such as POST, PUT, and DELETE. GET, HEAD, OPTIONS, and TRACE are excluded from the CSRF check, so list/get can succeed while only create/update/delete return 403.
The CSRF check only verifies that the cookie and header values match. For non-browser calls, first call an index path such as /kserve-endpoints/ once to get the XSRF-TOKEN cookie issued by the web app, then send both Cookie: XSRF-TOKEN=<value> and X-XSRF-TOKEN: <value> on subsequent mutating requests. Always reuse the cookie value issued by the web app as is. This also matches browser behavior.
Example:
curl -sk -c /tmp/kserve-cookies.txt \ -H "Authorization: Bearer ${TOKEN}" \ https://kubeflow.10.x.x.x.nip.io/kserve-endpoints/ >/dev/null
XSRF="$(awk '$6 == "XSRF-TOKEN" { print $7 }' /tmp/kserve-cookies.txt | tail -n 1)"
curl -sk -b /tmp/kserve-cookies.txt -X POST \ "https://kubeflow.10.x.x.x.nip.io/kserve-endpoints/api/namespaces/kubeflow-user-example-com/inferenceservices" \ -H "Authorization: Bearer ${TOKEN}" \ -H "Content-Type: application/json" \ -H "X-XSRF-TOKEN: ${XSRF}" \ --data '{"apiVersion":"serving.kserve.io/v1beta1","kind":"InferenceService","metadata":{"name":"example","namespace":"kubeflow-user-example-com"},"spec":{"predictor":{"model":{"modelFormat":{"name":"sklearn"},"storageUri":"gs://kfserving-examples/models/sklearn/1.0/model"}}}}'Identify the failure point by the response message. Could not find CSRF cookie XSRF-TOKEN, Could not detect CSRF protection header X-XSRF-TOKEN, and CSRF check failed come from the web app CSRF stage. No user detected means the gateway did not produce the kubeflow-userid header. User '<subject>' is not authorized to create serving.kserve.io/v1beta1/inferenceservices in namespace '<namespace>' means the request was blocked by the SubjectAccessReview performed by models-web-app. A KServe webhook validation error at the next stage should be treated as a problem with the InferenceService spec itself.
Deployment view
Section titled “Deployment view”Resource Placement
Section titled “Resource Placement”| Namespace | Resource | Name | Role |
|---|---|---|---|
kubeflow | Deployment | kserve-controller-manager | KServe CR reconcile and webhook backend |
kubeflow | Service | kserve-controller-manager-service, kserve-webhook-server-service | controller and webhook service endpoints |
kubeflow | ConfigMap | inferenceservice-config | deployment mode, ingress, storage initializer, agent/router settings |
kubeflow | Certificate | serving-cert, llmisvc-serving-cert, localmodel-serving-cert | webhook TLS certificates |
kubeflow | Deployment + Service | kserve-models-web-application | /kserve-endpoints/ UI |
kubeflow | VirtualService | kserve-models-web-application | /kserve-endpoints/ routing on kubeflow-gateway |
kubeflow | AuthorizationPolicy | kserve-models-web-application | allows UI traffic coming from istio-ingressgateway |
kubeflow | ServiceAccount + ClusterRole | kserve-models-web-application | performs SubjectAccessReview and reads, creates, updates, and deletes KServe/Knative resources |
| (cluster) | CRD | inferenceservices.serving.kserve.io | main model-serving API |
| (cluster) | CRD | servingruntimes.serving.kserve.io, clusterservingruntimes.serving.kserve.io | model runtime definitions |
| (cluster) | CRD | llminferenceservices.serving.kserve.io | LLM serving API; UI creation is not supported |
| (cluster) | ClusterServingRuntime | kserve-* runtimes | default runtime catalog per model format |
| (cluster) | ClusterRole | kubeflow-kserve-admin/edit/view | KServe permissions merged into Kubeflow aggregated RBAC |
| Profile namespace | InferenceService and derived Knative resources | created dynamically per model | predictor workloads and routing |
Diagram
Section titled “Diagram”PlantUML source:
Operational flow
Section titled “Operational flow”InferenceService reconcile and child resource creation
Section titled “InferenceService reconcile and child resource creation”When a user creates an InferenceService in a Profile namespace, the KServe webhook fills in defaults and performs validation. Then kserve-controller-manager reconciles the resource, builds the predictor spec by referring to inferenceservice-config and ClusterServingRuntime, and in serverless mode creates a Knative Service. Underneath, Knative builds the Configuration, Revision, Route, and revision Deployment/Pod/Service.
PlantUML source:
Model artifact download
Section titled “Model artifact download”An InferenceService with a storageUri must download the model first when the predictor Pod starts. KServe attaches an init container using the storageInitializer.image setting in inferenceservice-config. This init container downloads the model artifact from a storage URI such as gs://kfserving-examples/models/sklearn/1.0/model, and the model server container in the same Pod reads those files and starts serving.
That behavior applies both to ordinary object-storage URIs such as gs://... and, with the Model Registry integration installed, model-registry://... URIs.
PlantUML source:
Endpoint exposure
Section titled “Endpoint exposure”Because of the KServe path-based routing setting, the external URL takes the following form.
https://kserve.10.x.x.x.nip.io/serving/<namespace>/<name>/v1/models/<name>:predictThe important point is that endpoint exposure does not end with a single Kubernetes Service. The sklearn-iris and sklearn-iris-predictor Services are ExternalName Services, and both point to knative-local-gateway.istio-system.svc.cluster.local. The detailed traffic to the actual predictor Pod is determined jointly by the VirtualServices created by KServe/Knative, the Knative Route, and the revision Services.
PlantUML source:
Dependencies and interactions
Section titled “Dependencies and interactions”Prerequisites / downstream
Section titled “Prerequisites / downstream”- Prerequisites:
kubeflow-namespace,cert-manager,istio,oauth2-proxyM2M auth,kubeflow-istio-resources,kubeflow-roles,09-knative,08-user-profile. - Downstream: KServe
InferenceServiceexamples,LLMInferenceServicemanifests, and serving calls from Model Registry and the platform backend. Model Registry is also used formodel-registry://artifact resolution, andLLMInferenceServiceworkflows use the KServe APIs directly rather than the models-web-app UI. - Documents to read together: the KServe serverless runtime underneath is covered in Knative Serving, the serving host separation landmine in Kubeflow Istio Resources, and 2-hop JWT and predictor ALLOW in Authentication flow and User Profile.
Runtime interactions
Section titled “Runtime interactions”In inferenceservice-config, defaultDeploymentMode is Serverless, ingressGateway is kubeflow/kubeflow-gateway, localGateway is knative-serving/knative-local-gateway, and localGatewayService is knative-local-gateway.istio-system.svc.cluster.local. So KServe uses the Kubeflow gateway and the Knative local gateway at the same time.
ingressDomain must be kept separate as kserve.10.x.x.x.nip.io. If it is set to the same value as the Dashboard host, the InferenceService VirtualServices generated by KServe take over the Dashboard host, bypass oauth2-proxy ExtAuthZ, and the Dashboard gets blocked with RBAC: access denied.
models-web-app is only a UI inside the Dashboard. The actual predictor creation is done by kserve-controller-manager, and serving requests go to the kserve.10.x.x.x.nip.io/serving/... serving host, not the /kserve-endpoints/ UI path.
Key resources
Section titled “Key resources”inferenceservices.serving.kserve.io: the main model-serving API that users create.kserve-controller-manager: the controller that reconcilesInferenceServiceand runtime resources.inferenceservice-config: the ConfigMap that defines KServe default behavior, such as serverless mode, gateways, domain, pathTemplate, storage initializer, and agent/router images.ClusterServingRuntime: the default serving runtime catalog per model format.kserve-models-web-application: the KServe Endpoints UI in the Dashboard. It does not support creating or managingLLMInferenceService.kubeflow-kserve-admin/edit/view: connects the KServe permissions of Profile-namespace users to Kubeflow aggregated RBAC.platform-api-serving-access: an ALLOW policy added to the Profile namespace so that theplatform-apiServiceAccount subject passes the predictor sidecar authz.
KServe is the declarative serving front door of this Kubeflow stack. Users express serving intent through InferenceService; KServe chooses runtimes and prepares model downloads; Knative handles the serverless lifecycle; Istio exposes and secures the traffic path; and the models-web-app gives Dashboard users a manageable UI. The repository-specific patches mainly exist to make that whole stack behave safely in a multi-user Kubeflow environment with a dedicated serving domain and predictable auth behavior.
References
Section titled “References”- overlay:
overlays/dev/kubeflow/overlays/kserve/controller - overlay:
overlays/dev/kubeflow/overlays/kserve/models-web-app - upstream:
applications/kserve/kserve,applications/kserve/models-web-app - Related documents: