Skip to content

KServe

Interactive Diagram

새 탭 ↗
ItemValue
VersionKServe v0.18.0
Official docsKServe
Upstream sourceapplications/kserve

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 endpoint
  • KServe API: provides CRDs such as InferenceService, ServingRuntime, ClusterServingRuntime, InferenceGraph, TrainedModel, LLMInferenceService, and LocalModelCache.
  • KServe controller: kserve-controller-manager watches InferenceService and runtime resources and reconciles predictor workloads.
  • Serving runtime catalog: provides default ClusterServingRuntime definitions 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-config defines the Knative local gateway, the Kubeflow gateway, the path template, and a serving-specific ingressDomain.
  • models-web-app UI: installs the web app that lists and manages InferenceService resources 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”
LayerResponsibilityMain resources
KServemodel-serving API, runtime selection, predictor spec generation, storage initializer, inference URL settingsInferenceService, ServingRuntime, ClusterServingRuntime, inferenceservice-config
Knative Servingserverless workload lifecycle, revisions, routes, scale-to-zero, activator/autoscalerService, Revision, Route, Configuration, activator, autoscaler
Istio/Kubeflow gatewayexternal and internal routing, JWT validation, AuthorizationPolicykubeflow-gateway, knative-local-gateway, cluster-local-gateway, VirtualService
models-web-appKServe UI inside the Kubeflow Dashboardkserve-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.

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/v1beta1
kind: InferenceService
metadata:
name: sklearn-iris
namespace: kubeflow-user-example-com
spec:
predictor:
model:
modelFormat:
name: sklearn
storageUri: gs://kfserving-examples/models/sklearn/1.0/model

In 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:

  1. KServe sees modelFormat: sklearn and selects kserve-sklearnserver as the runtime.
  2. KServe arranges a storage initializer for storageUri.
  3. Because defaultDeploymentMode is Serverless, KServe creates a Knative Service such as sklearn-iris-predictor.
  4. Knative then creates a Configuration, Revision, Route, revision Deployment, Pods, and revision Services.
  5. Istio and Knative routing expose the predictor through the repository’s serving host and path conventions.
ResourceExample nameCreated byRole
InferenceServicesklearn-irisuser / GitOpsmodel-serving declaration
Knative Servicesklearn-iris-predictorKServe controllerpredictor serverless workload declaration
Knative Configurationsklearn-iris-predictorKnative Servingmanages the desired template and latest ready revision
Knative Revisionsklearn-iris-predictor-00001Knative Servingsnapshot of a specific predictor spec
Deploymentsklearn-iris-predictor-00001-deploymentKnative Servingruns the revision Pods
Podsklearn-iris-predictor-00001-deployment-...Kubernetes Deploymentruns the model server, queue-proxy, and sidecars
Servicesklearn-iris-predictor-00001, sklearn-iris-predictor-00001-privateKnative Servingrevision traffic and private traffic endpoints
ExternalName Servicesklearn-iris, sklearn-iris-predictorKnative/KServe routingpoints to knative-local-gateway.istio-system.svc.cluster.local
VirtualServicesklearn-iris... familyKServe / Knative net-istiorouting 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>.

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.

  • Model-serving API: users create an InferenceService in 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/view are merged into Kubeflow aggregated RBAC so users can manage KServe resources in their own namespace.
  • Dashboard integration: the KServe Endpoints entry 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 a platform-api token.

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/AuthorizationPolicy
AdjustmentTargetReason
Fix caBundle annotationsKServe CRDs and webhook configsupstream annotations point to kserve/<cert>, but the certificate is in the kubeflow namespace
Fix certificate SANsserving-cert, llmisvc-serving-cert, localmodel-serving-certwebhook Service DNS is *.kubeflow.svc, so the SANs must also be based on kubeflow
Remove localmodel node agent DaemonSetkserve-localmodelnode-agentavoid privileged, hostPID, and hostNetwork usage
Add RuntimeDefault seccompKServe controller deploymentsstrengthen the PodSecurity baseline
Remove insecure LLMInferenceServiceConfigLLMInferenceServiceConfig resourceremove configurations with unnecessary capabilities and non-root violations
Remove LLMInferenceServiceConfig validating webhookllminferenceserviceconfig.serving.kserve.iothat webhook server does not exist, so it can produce EOF validation errors
Path-based routing settinginferenceservice-configKServe generates /serving/<namespace>/<name> URLs automatically
Serving-specific domain settingingressDomain: kserve.10.x.x.x.nip.ioprevents host collision between the Dashboard and VirtualServices

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 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:

Terminal window
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.

NamespaceResourceNameRole
kubeflowDeploymentkserve-controller-managerKServe CR reconcile and webhook backend
kubeflowServicekserve-controller-manager-service, kserve-webhook-server-servicecontroller and webhook service endpoints
kubeflowConfigMapinferenceservice-configdeployment mode, ingress, storage initializer, agent/router settings
kubeflowCertificateserving-cert, llmisvc-serving-cert, localmodel-serving-certwebhook TLS certificates
kubeflowDeployment + Servicekserve-models-web-application/kserve-endpoints/ UI
kubeflowVirtualServicekserve-models-web-application/kserve-endpoints/ routing on kubeflow-gateway
kubeflowAuthorizationPolicykserve-models-web-applicationallows UI traffic coming from istio-ingressgateway
kubeflowServiceAccount + ClusterRolekserve-models-web-applicationperforms SubjectAccessReview and reads, creates, updates, and deletes KServe/Knative resources
(cluster)CRDinferenceservices.serving.kserve.iomain model-serving API
(cluster)CRDservingruntimes.serving.kserve.io, clusterservingruntimes.serving.kserve.iomodel runtime definitions
(cluster)CRDllminferenceservices.serving.kserve.ioLLM serving API; UI creation is not supported
(cluster)ClusterServingRuntimekserve-* runtimesdefault runtime catalog per model format
(cluster)ClusterRolekubeflow-kserve-admin/edit/viewKServe permissions merged into Kubeflow aggregated RBAC
Profile namespaceInferenceService and derived Knative resourcescreated dynamically per modelpredictor workloads and routing

PlantUML source:

PlantUML Diagram

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:

PlantUML Diagram

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:

PlantUML Diagram

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>:predict

The 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:

PlantUML Diagram
  • Prerequisites: kubeflow-namespace, cert-manager, istio, oauth2-proxy M2M auth, kubeflow-istio-resources, kubeflow-roles, 09-knative, 08-user-profile.
  • Downstream: KServe InferenceService examples, LLMInferenceService manifests, and serving calls from Model Registry and the platform backend. Model Registry is also used for model-registry:// artifact resolution, and LLMInferenceService workflows 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.

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.

  • inferenceservices.serving.kserve.io: the main model-serving API that users create.
  • kserve-controller-manager: the controller that reconciles InferenceService and 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 managing LLMInferenceService.
  • 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 the platform-api ServiceAccount 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.