Skip to content

Knative Serving

Interactive Diagram

새 탭 ↗
ItemValue
VersionKnative 1.22.0
Official docsKnative Serving
Upstream sourcecommon/knative/knative-serving, common/istio/cluster-local-gateway

Knative provides a serverless workload model on top of Kubernetes. In Kubeflow, Knative Serving is used mainly so that KServe can run InferenceService resources in serverless form and delegate routing, revisions, scale-to-zero, and activator-based request handling to it. This document focuses on Knative Serving as the foundation of KServe serving.

Relationship between the Knative Serving Activator, Autoscaler, Controller, Webhook, the ingress, and user Pods with a Queue-Proxy Source: Knative docs, Knative Serving Architecture, The Knative Authors, Apache-2.0

In this repository it is not treated as a stand-alone end-user product. It is mainly the substrate that lets KServe run InferenceService predictors in serverless mode.

  • Knative Serving control plane: installs activator, autoscaler, controller, webhook, net-istio-controller, and net-istio-webhook.
  • Serving CRDs: provides the APIs that the KServe serverless runtime depends on, such as services.serving.knative.dev, revisions.serving.knative.dev, routes.serving.knative.dev, and configurations.serving.knative.dev.
  • Kubeflow gateway integration: removes the default knative-ingress-gateway and patches config-istio so that it uses kubeflow/kubeflow-gateway and istio-ingressgateway.
  • cluster-local-gateway integration: keeps the Service/Gateway name knative-local-gateway, but points its selector at the cluster-local-gateway workload so that it handles the internal KServe serving hop.
  • Serving M2M 2-hop JWT validation: adds the legacy ServiceAccount token issuer to the cluster-local-gateway-jwt RequestAuthentication so that the second gateway hop of external serving calls also passes.

Upstream Knative can create its own ingress gateway, but this deployment manages Kubeflow web app traffic and serving traffic inside the Istio and Kubeflow gateway topology. For that reason the Knative Serving base removes knative-ingress-gateway and adds gateway.kubeflow.kubeflow-gateway: istio-ingressgateway.istio-system.svc.cluster.local to config-istio.

progressDeadline in config-deployment is raised to 600s, because large model image pulls and container startup can take longer than the default.

KServe does not treat a model serving workload as a plain Deployment. An InferenceService creates predictor revisions, the activator and autoscaler get involved depending on request volume, and external and internal endpoints are built from route and domain settings. Without this serverless layer, the KServe serverless serving path, scale-to-zero, and revision-based rollout do not work.

Without Knative Serving:

  • revision-based rollout would disappear,
  • scale-to-zero would disappear,
  • the activator and autoscaler path would disappear,
  • and the KServe serverless execution path described by this repository would not exist.
  • KServe serverless substrate: provides the APIs and controllers that let the KServe controller materialize an InferenceService as a Knative Service, Revision, and Route.
  • Istio routing integration: makes the Routes and VirtualServices created by Knative use the Kubeflow gateway and local gateway setup.
  • Internal serving hop security: puts JWT validation and an AuthorizationPolicy on cluster-local-gateway as well, so the second hop of KServe serving is not left open to anonymous traffic.
  • Kubeflow RBAC extension: adds aggregation labels to the Knative namespaced admin/edit/view ClusterRoles so that their permissions are merged into kubeflow-admin, kubeflow-edit, and kubeflow-view.

The dev overlay in this repository is a thin wrapper around the upstream common overlay. Serving applies the main body and the cluster-local-gateway M2M auth separately.

overlays/dev/knative-serving/overlays/gateways
-> common/knative/knative-serving/overlays/gateways
-> common/knative/knative-serving/base
overlays/dev/knative-serving/overlays/cluster-local-gateway
-> common/istio/cluster-local-gateway/overlays/m2m-auth
-> common/istio/cluster-local-gateway/base
-> dev patch: legacy issuer kubernetes/serviceaccount
Applied unitMain contentReason
knative-serving/overlays/gatewaysServing core, net-istio, Kubeflow gateway patch, Knative local gateway selector patchcontrol plane and routing basis for KServe serverless serving
knative-serving/overlays/cluster-local-gatewaycluster-local-gateway workload, Gateway, RequestAuthentication, AuthorizationPolicyinternal KServe serving hop and 2-hop JWT validation
ItemValue / behaviorMeaning
config-istiogateway.kubeflow.kubeflow-gateway -> istio-ingressgateway.istio-system.svc.cluster.localconnects the Knative external gateway to the Kubeflow gateway
knative-ingress-gatewayremovedno separate Knative ingress gateway is created
knative-local-gateway Serviceselector app: cluster-local-gateway, istio: cluster-local-gatewaykeeps the name Knative and KServe expect, while the actual Pods are cluster-local-gateway
knative-local-gateway Gatewayselector app: cluster-local-gateway, istio: cluster-local-gatewaydelivers local gateway traffic to the cluster-local-gateway workload
cluster-local-gateway-jwttwo bound token issuers + legacy issuer kubernetes/serviceaccountKServe serving 2-hop JWT validation
config-domainexample.com: ""Knative default domain placeholder
NamespaceResourceNameRole
knative-servingDeploymentactivatorreceives requests in front of scaled-to-zero revisions and triggers Pod activation
knative-servingDeploymentautoscalerscales revisions based on request metrics
knative-servingDeploymentcontrollerreconciles Knative Service, Route, Revision, and Configuration
knative-servingDeploymentwebhookvalidation and defaulting for Serving resources
knative-servingDeploymentnet-istio-controller, net-istio-webhookconnects Knative Routes to Istio VirtualServices and Gateways
knative-servingConfigMapconfig-istio, config-domain, config-deploymentgateway, domain, and deployment deadline settings
knative-servingGatewayknative-local-gatewaythe Istio Gateway name referenced by local serving routes
istio-systemServiceknative-local-gatewayits selector actually points at cluster-local-gateway Pods
istio-systemDeployment + Servicecluster-local-gatewaysecond gateway hop for internal KServe serving routes
istio-systemRequestAuthenticationcluster-local-gateway-jwtBearer token validation at cluster-local-gateway
istio-systemAuthorizationPolicycluster-local-gateway, cluster-local-gateway-require-jwtallows only requests with a JWT principal and rejects anonymous requests
(cluster)CRD*.serving.knative.dev and othersKnative Serving API
(cluster)ClusterRoleknative-serving-namespaced-*user-facing permissions merged into Kubeflow aggregated RBAC

PlantUML source:

PlantUML Diagram
  • Prerequisites: Istio control plane, istio-ingressgateway, kubeflow-gateway, the cluster JWKS proxy, and the baseline roles for Kubeflow aggregated RBAC.
  • Downstream: the KServe controller and the KServe InferenceService runtime, plus Profile-namespace serving workloads that rely on Knative revisions, routes, and autoscaling.
  • Documents to read together: serving external host and Dashboard host separation is covered in Kubeflow Istio Resources, M2M 2-hop authentication in Authentication flow, and user-namespace permissions and the serving predictor ALLOW policy in Multi-tenancy and User Profile.

When KServe reconciles an InferenceService, a Service, Revision, and Route are created through the Knative Serving API, and the Serving controller and net-istio-controller materialize them as Pods, Services, and Istio VirtualServices. In the scaled-to-zero state, the activator receives the request and triggers revision Pod activation, and the autoscaler adjusts the replica count according to request metrics.

In order, the runtime path is:

  1. KServe creates Knative Serving resources.
  2. Knative controller and net-istio-controller reconcile them.
  3. Knative creates the revision Deployment/ReplicaSet/Pods and routing resources.
  4. If there is no ready Pod, activator handles the initial request path.
  5. autoscaler adjusts replica counts based on traffic.
  6. External traffic enters through istio-ingressgateway using the Kubeflow gateway mapping.
  7. Internal serving traffic traverses the cluster-local-gateway hop through the preserved knative-local-gateway naming contract.

External serving requests arrive on the kserve.10.x.x.x.nip.io host and get the first JWT validation at istio-ingressgateway. When the KServe/Knative route forwards them to the internal predictor host, they pass through cluster-local-gateway as the second hop. At that point cluster-local-gateway-jwt must also contain the legacy issuer kubernetes/serviceaccount, so that legacy ServiceAccount tokens such as platform-api-token pass. If only the first hop validates JWTs, the second hop can still reject the request. This matters especially for machine-to-machine callers that use ServiceAccount-derived tokens rather than browser-driven auth flows. Changes to RequestAuthentication and AuthorizationPolicy are pushed through xDS, so they take effect without restarting Pods.

Knative is a prerequisite layer. If it is unhealthy, KServe failures can appear higher in the stack even though the root cause is here.

  • config-istio: sets the Kubeflow gateway as the external gateway Knative uses.
  • knative-local-gateway Service/Gateway: the name is the local gateway Knative and KServe expect, but the actual workload is cluster-local-gateway.
  • cluster-local-gateway-jwt: the JWT validation point for the serving second hop. It trusts both the bound token issuers and the legacy issuer.
  • cluster-local-gateway-require-jwt: rejects requests without a JWT principal, except on health/metrics paths.
  • activator, autoscaler, controller, webhook: the core control plane for the Knative Serving runtime and API lifecycle.
  • Knative namespaced ClusterRole: merged into Kubeflow aggregated RBAC so that Profile-namespace users can manage Knative and KServe related resources.

Knative Serving is the serverless execution substrate underneath KServe in this repository. Its real value is not a user-facing UI but a reliable contract for revisions, autoscaling, activator behavior, and request routing that fits the Kubeflow gateway topology. The repository-specific patches mostly exist to make that substrate work with the shared ingress design and the two-hop JWT security model.

The following table summarizes the additional adjustments applied to the deployment.

AdjustmentTargetWhy it exists
Remove knative-ingress-gatewayKnative gateway resourcesavoid creating a second, separate ingress gateway stack
Patch config-istioKnative configmap gateway.kubeflow.kubeflow-gateway to istio-ingressgateway.istio-system.svc.cluster.local
Keep knative-local-gateway namesService and Gatewaypreserve the names Knative and KServe expect
Redirect selectors to cluster-local-gatewayService and Gateway selectorsmake the actual traffic land on the repository’s shared local-gateway workload
Add legacy issuer support to cluster-local-gateway-jwtRequestAuthenticationallow the second hop to accept legacy ServiceAccount tokens such as platform-api-token
Extend progressDeadline to 600sconfig-deploymentlarge model images can need longer pulls and slower startup