Skip to content

Self-hosted and proxy runtimes

A deployed model is served in one of two ways. A self-hosted model runs an engine, such as vLLM or TGI, in your cluster against weights you hold. A proxy model runs a small proxy in your cluster in front of a hosted provider, so a project calls a hosted model through the same kind of Service it would call a self-hosted one, and the provider credential stays on your side. The serve assignment carries exactly one of the two runtime contracts. This page covers what the node deploys for each, how it checks what it deployed, and the replica bounds both share.

The two runtimes

flowchart TB
  subgraph SH["SELF-HOSTED, model.serve.self_hosted_runtime.v1"]
    direction TB
    SSV["Service<br/>port 80 to the engine port"]
    subgraph SP["Engine pod"]
      direction TB
      INIT["weights-bucket-stage<br/>init container, bucket lane"]
      ENG["model-runtime<br/>engine image by digest"]
      INIT --> ENG
    end
    WV[("Weights<br/>volume or emptyDir")]
    CV[("Cache volume<br/>optional")]
    SSV --> ENG
    WV --- ENG
    CV --- ENG
  end
  subgraph PXR["PROXY, proxy.runtime.v1"]
    direction TB
    PSV["Service<br/>port 80 to 8080"]
    PRX["proxy<br/>xratu-proxy-runtime"]
    CFG[("ConfigMap<br/>proxy program")]
    PSV --> PRX
    CFG --- PRX
  end
  UP[("Hosted provider<br/>upstream_endpoint")]
  PRX ==>|"composed Authorization"| UP

Both runtimes are a Deployment behind a ClusterIP Service in the model namespace, and both are reached on port 80. The pods differ: one runs an engine serving your weights, the other a proxy forwarding to a provider.

Self-hosted runtime

The contract

model.serve.self_hosted_runtime.v1 carries:

Field Holds
namespace, deployment_ref, service_ref, endpoint Where the runtime lives and how it is called
runtime_image_ref, runtime_image_digest The engine image, pinned by digest
engine_type, engine_version, engine_channel The engine from the catalog
runtime_args, listen_port The engine's arguments and port, 8080 by default
readiness_path, inference_path Where the engine reports ready and takes requests
interface, api_standard How callers talk to it
model_source_ref, runtime_source_path The weights the engine serves and where it finds them
desired_replicas, min_replicas, max_replicas, idle_timeout Replica bounds
resources CPU and memory requests and limits
gpu_runtime_class model.self_hosted_gpu_runtime_class.v1
runtime_class_name, node_selector, tolerations Placement
runtime_image_auth The auth slot for a private engine image

The engine's own needs come in the engine runtime consumption contract, model.engine_runtime_consumption.v1: the input kind and layout it expects, the mount target and whether the mount is read-only, and how the model is passed to it (model_arg_mode, model_arg_key). The node builds the engine's arguments and mounts from that contract, so an engine receives its weights in the form it reads.

What the node deploys

For serve_start and readiness_check the node applies:

  • A Deployment, deployment_ref, with one container model-runtime on the engine image. Its readiness and liveness probes are HTTP GETs on readiness_path, starting after 5 seconds and repeating every 5.
  • The weights as the weights-store volume at runtime_source_path: the staged PersistentVolumeClaim on the pvc lane, or an emptyDir filled by the weights-bucket-stage init container on the bucket lane. See Serve materialization and contract projection.
  • The cache volume, cache-store, when the runtime storage contract names one.
  • Placement: GPU resources, the accelerator node selector, tolerations and the runtime class. See GPU sharing runtime.
  • Image pull credentials from the runtime_image_auth slot when the engine image is private. See Model-serving secret resolution.
  • A Service, service_ref, selecting the Deployment on port 80.

serve_stop deletes the Deployment and the Service.

Checking what was deployed

Applying a manifest proves only that Kubernetes accepted it. After applying, the node reads the Deployment back and compares what Kubernetes will run with what was requested:

Evidence Compares On a mismatch
model.serve.self_hosted_resource_operational_evidence.v1 CPU and memory requests and limits MODEL_SERVE_SELF_HOSTED_RUNTIME_RESOURCE_OPERATIONAL_MISMATCH
model.serve.self_hosted_gpu_operational_evidence.v1 Runtime class, node selector, tolerations, GPU resource key and quantity, accelerator MODEL_SERVE_SELF_HOSTED_RUNTIME_GPU_OPERATIONAL_MISMATCH

Each records requested, observed, mismatch_fields and matches_requested. A mutating admission webhook that rewrote a limit or dropped a toleration surfaces here as a named field, before the model serves.

On readiness_check the node then waits up to 180 seconds for the Deployment's replicas to become ready, and records the ready and desired counts. Each command against the cluster has a 20 second limit.

The self-hosted evidence, model.serve.self_hosted_runtime_evidence.v1, holds the contract as applied, both operational evidence documents, the stage job policy and the stage job cleanup.

Code Condition
MODEL_SERVE_SELF_HOSTED_RUNTIME_CONTRACT_INVALID The contract is malformed or disagrees with the materialization
MODEL_SERVE_SELF_HOSTED_RUNTIME_PHASE_INVALID The phase is outside serve_start, readiness_check, serve_stop
MODEL_SERVE_SELF_HOSTED_RUNTIME_NAMESPACE_PRECONDITION_FAILED The model namespace is missing
MODEL_SERVE_SELF_HOSTED_RUNTIME_COMMAND_FAILED Applying or reading a cluster object failed, or readiness timed out
MODEL_SERVE_SELF_HOSTED_RUNTIME_RESOURCE_OPERATIONAL_MISMATCH Kubernetes will run different resources from those requested
MODEL_SERVE_SELF_HOSTED_RUNTIME_GPU_OPERATIONAL_MISMATCH Kubernetes will run a different GPU placement from the one requested

Proxy runtime

The contract

proxy.runtime.v1 carries:

Field Holds
provider, upstream_endpoint The hosted provider and its base URL
upstream_authorization_binding_key, upstream_authorization_scheme The declared key for the provider credential, and the scheme, Bearer by default
provider_model_ref, model_resolution_mode The provider's model and whether the proxy may supply it
interface, api_standard, model_default_endpoint_matrix The caller interface and the endpoints the default model applies to
namespace, deployment_ref, service_ref, listen_port Where the proxy runs, on 8080
runtime_image_ref, cpu, memory The proxy image and its resources
probe_method, probe_path, probe_payload_kind How the inference probe reaches the provider

The contract names the credential by its declared key and scheme only. A contract that still carries a composed upstream_authorization is refused with MODEL_PROXY_RUNTIME_CONTRACT_INVALID.

The upstream credential

The node resolves the proxy_upstream_auth slot from the serve assignment's lease and composes the header on its side, <scheme> <value>. The value exists only on the node and in the proxy. When the key has no resolved value, the proxy sends no upstream Authorization header at all, so an unbound credential fails upstream as unauthenticated. With no binding key in the contract, the proxy forwards the caller's own Authorization header to the provider.

What the proxy does to a request

flowchart TB
  RQ["Request from a project"]
  M{{"provider_default_or_client,<br/>normalized openai-v1,<br/>endpoint in the matrix?"}}
  HM{{"Request names a model?"}}
  INJ["Set model to provider_model_ref"]
  FW["Forward to upstream_endpoint<br/>Host and Authorization set"]
  RQ --> M
  M -->|"no"| FW
  M -->|"yes"| HM
  HM -->|"yes"| FW
  HM -->|"no"| INJ --> FW

The proxy forwards each request to the provider, joining the request path to the upstream endpoint's path, with a 300 second upstream limit. Under client_supplied_model_required, the default, the request body is forwarded as sent and the caller names the model. Under provider_default_or_client, a request on one of the endpoints in model_default_endpoint_matrix that names no model is given provider_model_ref; for openai-v1 the matrix holds POST /v1/chat/completions.

What the node deploys

For serve_start and readiness_check the node applies a ConfigMap holding the proxy program, a Deployment with one proxy container that runs it, and a Service on port 80 to 8080. serve_stop deletes them. The Deployment waits up to 60 seconds to become ready, and the node reports proxy.runtime_evidence.v1.

Code Condition
MODEL_PROXY_RUNTIME_CONTRACT_INVALID The contract is malformed or carries a composed header
MODEL_PROXY_RUNTIME_PHASE_INVALID The phase is outside serve_start, readiness_check, serve_stop
MODEL_PROXY_RUNTIME_NAMESPACE_PRECONDITION_FAILED The model namespace is missing
MODEL_PROXY_RUNTIME_COMMAND_FAILED Applying or reading a cluster object failed

Replica bounds

Both runtimes take their replicas from the control plane. Before it changes anything, the node's scaling preflight normalizes the bounds and checks that min_replicas ≤ desired_replicas ≤ max_replicas; outside the bounds the serve fails with MODEL_SERVE_SCALING_PREFLIGHT_FAILED. idle_timeout is a duration such as 300s, 15m, 2h or 1d.

The node applies the desired count to the Deployment and reports model.scaling_runtime_evidence.v1: the bounds, the idle timeout, the runtime kind, and the Deployment as the controller. Scaling decisions, including scale to zero and waking, are made by the control plane's autoscale controller and reach the node as a new desired count. See Serve runtime, scaling, and scale to zero.