Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Kserve Kserve ServingRuntime CRD

From Leeroopedia
Knowledge Sources
Domains Kubernetes, CRD, Serving Runtime
Last Updated 2026-02-13 00:00 GMT

Overview

Concrete CRD definition for the ServingRuntime custom resource in the KServe serving API.

Description

This file contains the auto-generated full CustomResourceDefinition for the ServingRuntime kind, produced by controller-gen v0.19.0. It belongs to the serving.kserve.io API group at version v1alpha1 and is a namespaced resource. The CRD is structurally identical to ClusterServingRuntime but scoped to a single namespace, allowing namespace-level serving runtime templates that can override or supplement cluster-wide definitions. It includes printer columns for Disabled status, ModelType, Containers, and Age.

Usage

Apply this CRD during KServe installation to register the ServingRuntime API with the Kubernetes API server. Namespace administrators then create ServingRuntime resources to define namespace-scoped serving runtime templates that InferenceService resources within the same namespace can reference. Namespace-scoped runtimes take precedence over cluster-scoped ClusterServingRuntime resources of the same name.

Code Reference

Source Location

Signature

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  name: servingruntimes.serving.kserve.io
spec:
  group: serving.kserve.io
  names:
    kind: ServingRuntime
    listKind: ServingRuntimeList
    plural: servingruntimes
    singular: servingruntime
  scope: Namespaced
  versions:
    - name: v1alpha1
      additionalPrinterColumns:
        - jsonPath: .spec.disabled
          name: Disabled
          type: boolean
        - jsonPath: .spec.supportedModelFormats[*].name
          name: ModelType
          type: string
        - jsonPath: .spec.containers[*].name
          name: Containers
          type: string
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      subresources: {}

Import

kubectl apply -f config/crd/full/serving.kserve.io_servingruntimes.yaml

I/O Contract

Inputs

Name Type Required Description
apiVersion string Yes Must be serving.kserve.io/v1alpha1
kind string Yes Must be ServingRuntime
metadata ObjectMeta Yes Standard Kubernetes object metadata including namespace
spec ServingRuntimeSpec Yes Serving runtime specification defining containers, model formats, and runtime behavior

Key spec fields:

Field Type Required Description
spec.containers []Container Yes One or more container definitions for the serving runtime (image, command, args, env, resources, ports, volume mounts)
spec.supportedModelFormats []SupportedModelFormat No List of model formats supported by this runtime (e.g., sklearn, tensorflow, pytorch, onnx)
spec.disabled boolean No When true, this runtime is disabled and will not be selected for model serving
spec.affinity Affinity No Pod scheduling affinity rules (node affinity, pod affinity, pod anti-affinity)
spec.tolerations []Toleration No Pod tolerations for scheduling on tainted nodes
spec.volumes []Volume No Additional volumes to mount into the runtime containers

Outputs

Name Type Description
status object Empty status object (no status fields are currently defined for this resource)

Usage Examples

Create a ServingRuntime

apiVersion: serving.kserve.io/v1alpha1
kind: ServingRuntime
metadata:
  name: custom-sklearn-runtime
  namespace: ml-team
spec:
  supportedModelFormats:
    - name: sklearn
      version: "1"
      autoSelect: true
  containers:
    - name: kserve-container
      image: myregistry/sklearn-server:v1.2
      args:
        - --model_name={{.Name}}
        - --model_dir=/mnt/models
      resources:
        requests:
          cpu: 500m
          memory: 512Mi
        limits:
          cpu: "1"
          memory: 1Gi

List ServingRuntimes

kubectl get servingruntimes -n ml-team
# NAME                     DISABLED   MODELTYPE   CONTAINERS         AGE
# custom-sklearn-runtime   false      sklearn     kserve-container   3d

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment