Disabling KServe HTTPRoute Generation to Route Models by a Single Host and Path
This post records how we moved KServe on Gateway API (implemented by Envoy Gateway) away from its default of one host per model, to a single llm.<domain> host with a path per model. Gateway API and Envoy Gateway themselves are covered in Why Gateway API, Envoy Gateway Setup and HTTPRoute Routing and Verification, so this post focuses only on the HTTPRoutes KServe creates and what happens after you turn them off.
The target version is KServe v0.19.0. Behavior described here was confirmed by reading pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/httproute_reconciler.go at that tag. Example values are generalized: the domain is example.com and the namespace is models.
HTTPRoutes KServe creates by default
Section titled “HTTPRoutes KServe creates by default”In Gateway API mode (enableGatewayApi: true) with Standard (Raw) deployment, KServe creates HTTPRoutes itself every time it reconciles an InferenceService (ISVC). A predictor-only ISVC gets two.
| HTTPRoute name | host | Sends to |
|---|---|---|
<isvc> (top-level) | Host built from domainTemplate, default <isvc>-<namespace>.<ingressDomain> | Transformer Service if present, otherwise predictor Service |
<isvc>-predictor | Same template with the name <isvc>-predictor | Predictor Service |
With a transformer or explainer, <isvc>-transformer and <isvc>-explainer routes are added the same way. Details confirmed in the source:
- Every route uses path match type
RegularExpression. The default rule^/.*$accepts every path. With an explainer, the top-level route also gets a^/v1/models/[\w-]+:explain$rule. - Each rule has a
RequestHeaderModifierfilter that sets ISVC name and namespace headers. - If the predictor Service exposes both REST and gRPC ports, a gRPC rule (
content-type: application/grpc*header plus/inference.GRPCInferenceService/path) comes first and an HTTP fallback rule second. - Routes carry an ownerReference with the ISVC as controller, so deleting the ISVC garbage-collects them.
status.urlis set from the top-level host. It contains no path.
The number of hosts grows with the number of models. The pattern in the Gateway API docs, one route and one Service per host, repeats once per model.

The shape we wanted
Section titled “The shape we wanted”There were two goals.
- Callers know only
llm.example.comand pick a model by path, for examplehttp://llm.example.com/models/qwen/v1/chat/completions. - Routes are managed by the app deployment manifests (the GitOps repository), not by the KServe controller, so which path goes to which Service shows up in a Git diff.
Turning generation off
Section titled “Turning generation off”The setting lives in the ingress entry of the inferenceservice-config ConfigMap in the kserve namespace. Two values changed.
{ "enableGatewayApi": true, "kserveIngressGateway": "<gateway-namespace>/<gateway-name>", "ingressDomain": "example.com", "domainTemplate": "llm.{{ .IngressDomain }}", "disableIngressCreation": true, "urlScheme": "http"}disableIngressCreation: true stops HTTPRoute creation, and domainTemplate decides the host that goes into status.url. The v0.19 configmap comment also describes disableIngressCreation as a raw deployment mode setting.
What actually changes
Section titled “What actually changes”The branch in Reconcile makes the behavior clear.
if !isInternal && !r.ingressConfig.DisableIngressCreation { // predictor, transformer, explainer, top-level route reconcile ...} else { // Ingress creation is disabled. We set it to true as the isvc condition depends on it. isvc.Status.SetCondition(v1beta1.IngressReady, ...ConditionTrue...)}if isvc.Status.URL, err = createRawURL(isvc, r.ingressConfig); err != nil {Three facts with operational impact follow.
- Existing routes are not deleted. The else branch has no delete code. Old routes stay while the ISVC lives, keep serving the old hosts, and are no longer updated by the controller. Because of the ownerReference they go away when the ISVC is deleted. To cut the old hosts, delete them yourself.
- The
IngressReadycondition is always True. The ISVC looks Ready even with no route. Whether routing works cannot be read from ISVC status; check your own HTTPRoute status and a real call. status.urlswitches to the newdomainTemplateimmediately.createRawURLonly builds the host from the template, so every ISVC’sstatus.urlbecomes the samehttp://llm.example.com. With no path, that value alone no longer identifies a model.
Existing model calls kept working because of how the app was built. It read status.url once when a model was registered, stored it, and called the stored value afterwards. A client that re-reads status.url per request or periodically would have pointed every model at the same host the moment the setting changed. Before changing the setting, check when your callers read status.url.
No need to recreate the predictor route
Section titled “No need to recreate the predictor route”The <isvc>-predictor route gives a separate host that goes straight to the predictor component. With a transformer, the top-level host goes to the transformer, so calling the predictor directly needs this route.
For an ISVC with only a predictor (no transformer or explainer), the source shows the top-level route also sends to the predictor Service in its else branch. Both routes have the same backend Service, so when managing routes yourself, one route per model is enough.
Why not pathTemplate
Section titled “Why not pathTemplate”KServe has a path-based option too. Setting pathTemplate: "/serving/{{ .Namespace }}/{{ .Name }}" in ingress adds a path rule to the top-level route. We did not use it because of these constraints, confirmed in the v0.19 source.
- The path rule is attached to
ingressDomainitself. The source appendsingressConfig.IngressDomaintoallowedHosts. It lands onexample.com, not on a separate host such asllm.example.com. - Per-model hosts remain. The path rule is only added to the top-level route; the host-based rules and predictor route are still created.
- The prefix is not stripped. The path rule matches
<path>/as aRegularExpression, and the only filter adds headers. There is no URLRewrite, so the model server receives the full path such as/serving/models/qwen/v1/.... That does not suit servers that only handle/v1/..., like OpenAI-compatible servers. status.urldoes not include the path.createRawURLonly builds the host.- The match type is
RegularExpression. In Gateway API, RegularExpression path match is Implementation-specific, so regex syntax and behavior can differ between implementations. - The
pathTemplatecomment in the v0.19 configmap example says “only applicable to serverless deployment”, yet the HTTPRoute reconciler implements it. Documentation and code disagree, so verify per version before relying on it.
Turning generation off and writing routes ourselves was simpler than layering extra settings to work around these.
The HTTPRoute we manage
Section titled “The HTTPRoute we manage”One route per model. For an ISVC named qwen in namespace models:
apiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata: name: qwen namespace: modelsspec: parentRefs: - name: <gateway-name> namespace: <gateway-namespace> hostnames: - llm.example.com rules: - matches: - path: type: PathPrefix value: /models/qwen filters: - type: URLRewrite urlRewrite: path: type: ReplacePrefixMatch replacePrefixMatch: / backendRefs: - name: qwen-predictor port: 80- The path follows
/<namespace>/<isvc>, so ISVCs with the same name in different namespaces do not collide. ReplacePrefixMatch: /strips the prefix, so the model server receives its original path (/v1/chat/completionsand so on). The Gateway API CRD validates that a rule usingReplacePrefixMatchhas exactly one PathPrefix match.- The backend is the
<isvc>-predictorService KServe creates, on port 80. The KServe source uses the same value as its default HTTP port (CommonDefaultHttpPort). - The Gateway listener’s
allowedRoutesmust accept routes from other namespaces. That is covered in Envoy Gateway Setup.
When another API started sharing the llm.example.com host, we narrowed that API’s route from all of / to a specific prefix such as /internal/v1/agent. Gateway API prefers the PathPrefix match with the most characters, but once routes from several teams share a host, it gets hard to read who owns which prefix. Not leaving broad prefixes around prevents mistakes.
Moving to another implementation
Section titled “Moving to another implementation”No Envoy Gateway specific resources (SecurityPolicy, BackendTrafficPolicy and so on) are used for this routing. Gateway API support levels of the fields used, per the comments in apis/v1/httproute_types.go on the Gateway API repository’s main branch:
| Field | Support level |
|---|---|
hostnames | Core |
path match PathPrefix | Core |
Kubernetes Service in backendRefs | Core |
URLRewrite filter | Extended |
When moving to another implementation, only URLRewrite ReplacePrefixMatch support needs checking. The routes KServe generates use RegularExpression matches (Implementation-specific) and timeouts (Extended), so the generated routes actually need more checks when switching implementations. KServe v0.19’s disableHTTPRouteTimeout option exists for implementations that do not support the timeouts field.
An operational problem: the route outlives the ISVC
Section titled “An operational problem: the route outlives the ISVC”Deleting an ISVC also deletes the predictor Service KServe created. A hand-made HTTPRoute has no such link, so it stays, and its parent condition in status shows an error of the form service ... not found. The exact message and reason can differ by implementation and version, so read status.parents[].conditions from kubectl get httproute <name> -o yaml directly.
Route lifetime has to be managed together with the ISVC. Keeping the ISVC and HTTPRoute in the same kustomize directory lets the GitOps tool create and delete them as one unit. If there is a procedure that deletes only the ISVC, route deletion must be part of it.
Verification order
Section titled “Verification order”Changes were verified in this order.
# Does the manifest render as expectedkustomize build overlays/<env> > /tmp/rendered.yaml
# Schema and CRD validation by the API server (nothing is persisted)kubectl apply --dry-run=server -f /tmp/rendered.yaml
# Route status after Git push and Argo CD synckubectl -n models get httproute qwen -o yaml
# A real callcurl -s http://llm.example.com/models/qwen/v1/models--dry-run=server catches CRD schema and CEL validation (for example the ReplacePrefixMatch and PathPrefix rule), but it does not tell you whether the backend Service exists or whether the Gateway accepts the route. That can only be confirmed after sync, from the route’s Accepted and ResolvedRefs conditions and the curl result.
Summary
Section titled “Summary”- In KServe v0.19,
disableIngressCreationonly stops new route creation. Existing routes stay,IngressReadybecomes True, andstatus.urlfollows the newdomainTemplate. - When callers read
status.urldecides whether the switch is safe. - A predictor-only ISVC needs just one route per model, using PathPrefix and URLRewrite.
- Hand-made routes must share the ISVC’s lifetime.