← All posts

Kubeflow: Production-Grade ML on Kubernetes

Most of a machine-learning system is not machine learning. Sculley et al. made the case in 2015 in Hidden Technical Debt in Machine Learning Systems. Their argument is that the quick wins of building a prediction system carry large ongoing maintenance costs. Notebooks that run on one laptop, hand-started training and a deployment step that lives in someone's head are the everyday form of that debt.

Kubeflow is a set of projects for paying it down on Kubernetes.

In short

  • Kubeflow is a set of Kubernetes-only components, and you can deploy them standalone instead of installing the full distribution.
  • Pipelines (scheduled, recorded runs) and Trainer (distributed training) cover repeatable runs and multi-node training; Katib is deprecated.
  • The installation page gives no Kubernetes version or resource requirements, so the operational cost is yours to measure.
  • If you only need run tracking and a model registry, or you have no Kubernetes cluster, MLflow is the smaller choice; see the decision table.

What is current, and what has changed

The components page now lists Kubeflow SDK, Spark Operator, Notebooks, Workspaces, Trainer, MCP Server, Katib, Hub, Pipelines, Dashboard and Kale. Hub is described there as "formerly Model Registry". The docs banner says Kubeflow is now a CNCF graduated project, and the CNCF page gives the dates: accepted on 25 July 2023 at the Incubating level, moved to Graduated on 24 July 2026.

Two changes stand out. First, the Katib docs state that Katib is deprecated and tell users to migrate to the OptimizationJob APIs in Kubeflow Trainer, behind an alpha feature gate. The installation page gives 1 November 2026 for the deprecation and 1 November 2027 for archiving, and says development is halted. Second, Trainer succeeds the old Training Operator (V1), which its docs now call legacy; older material may still describe V1, so follow the migration guide rather than mixing the two.

Serving is not in that list. KServe began inside Kubeflow and is now a separate project, so the diagram below shows it beside Kubeflow. The CNCF accepted it at the Incubating level on 29 September 2025 and announced it on 11 November 2025.

ML lifecycle stages and the Kubeflow component that covers each Explore Pipeline Train Tune Register Serve Notebooks Pipelines Trainer Katib (deprecated) Hub KServe (separate) Pipelines can orchestrate the train, tune and register steps on the same Kubernetes cluster
Figure 1. Lifecycle stages and the component for each. Pipelines orchestrate; the other components can also be used on their own.

Components, purpose and when you need them

ComponentPurposeLevel (installation page)You need it when
NotebooksJupyterLab, RStudio and VS Code environments running in the clusterGraduatedExploration must happen next to cluster data and GPUs
PipelinesContainerised workflows defined in PythonGraduatedRuns must be repeatable, scheduled and recorded
TrainerDistributed training jobsGraduatedOne node or one GPU is not enough
HubModel registry (formerly Model Registry)GraduatedSeveral people need one record of model versions
KatibHyperparameter tuningDeprecatedExisting users only; new work should look at OptimizationJob
SDK, KalePython client; notebook-to-pipeline toolingIncubatingOptional

Pipelines v2

A pipeline is a directed acyclic graph of components. Each component runs as one container execution. The pipeline function is not run directly: it is compiled to IR YAML, which the backend converts into instructions to launch Kubernetes Pods, with steps running in parallel by default when no dependency exists. The overview describes the IR YAML as platform-neutral and names Google Cloud Vertex AI Pipelines as another KFP-conformant backend that can run it.

On the open-source backend, the repository README says Kubeflow Pipelines orchestrates Kubernetes resources with Argo Workflows by default, using the Argo Emissary executor.

Typed artifacts. A component declares Input[Dataset] or Output[Model]. Inside the function, .path is a local file you read or write, .uri is the storage location, and .metadata is a dictionary stored with the artifact. The artifacts guide says input artifacts should be treated as immutable, and that a component declaring an Output[...] artifact should not return the artifact instance.

A pipeline that trains a scikit-learn model

Written against KFP 2.18.2 (the latest on PyPI on 28 November 2026). It compiles to IR YAML with sdkVersion: kfp-2.18.2, and both function bodies run locally against scikit-learn, but I have not run the compiled pipeline on a KFP backend. The pins in packages_to_install are the versions the function bodies were run with; scikit-learn 1.9.1 and pandas 3.1.1 need Python 3.11 or later, which the base image provides.

from kfp import compiler, dsl
from kfp.dsl import Dataset, Input, Metrics, Model, Output


@dsl.component(
    base_image="python:3.11",
    packages_to_install=["scikit-learn==1.9.1", "pandas==3.1.1"],
)
def make_data(n_samples: int, data: Output[Dataset]):
    import pandas as pd
    from sklearn.datasets import make_classification

    X, y = make_classification(
        n_samples=n_samples, n_features=10, random_state=0
    )
    df = pd.DataFrame(X, columns=[f"f{i}" for i in range(10)])
    df["label"] = y
    df.to_csv(data.path, index=False)
    data.metadata["rows"] = len(df)


@dsl.component(
    base_image="python:3.11",
    packages_to_install=[
        "scikit-learn==1.9.1", "pandas==3.1.1", "joblib==1.6.0",
    ],
)
def train(
    data: Input[Dataset],
    n_estimators: int,
    model: Output[Model],
    metrics: Output[Metrics],
):
    import joblib
    import pandas as pd
    from sklearn.ensemble import RandomForestClassifier
    from sklearn.model_selection import train_test_split

    df = pd.read_csv(data.path)
    X, y = df.drop(columns="label"), df["label"]
    X_tr, X_te, y_tr, y_te = train_test_split(
        X, y, test_size=0.2, random_state=0
    )
    clf = RandomForestClassifier(
        n_estimators=n_estimators, random_state=0
    )
    clf.fit(X_tr, y_tr)
    metrics.log_metric("accuracy", float(clf.score(X_te, y_te)))
    joblib.dump(clf, model.path)
    model.metadata["framework"] = "scikit-learn"


@dsl.pipeline(name="sklearn-train")
def sklearn_pipeline(n_samples: int = 2000, n_estimators: int = 100):
    d = make_data(n_samples=n_samples)
    train(data=d.outputs["data"], n_estimators=n_estimators)


if __name__ == "__main__":
    compiler.Compiler().compile(
        sklearn_pipeline, "sklearn_pipeline.yaml"
    )

Submit the compiled file with the client, as in the getting-started guide. It needs a running KFP backend and its endpoint:

from kfp.client import Client

client = Client(host="<MY-KFP-ENDPOINT>")
run = client.create_run_from_pipeline_package(
    "sklearn_pipeline.yaml",
    arguments={"n_samples": 2000, "n_estimators": 200},
)

The Metrics output carries the accuracy, so runs can be compared in the UI.

Trainer for distributed PyTorch

The Trainer overview names two APIs, TrainJob and Runtimes: administrators manage runtimes, practitioners submit TrainJobs. Listed frameworks include PyTorch, JAX and XGBoost.

The getting-started guide installs the SDK with pip install -U kubeflow and trains a Fashion-MNIST CNN with PyTorch DistributedDataParallel on 4 nodes, using the torch-distributed runtime. The call looks like this (the training function body is elided):

from kubeflow.trainer import TrainerClient, CustomTrainer

def train_pytorch():
    ...  # init process group, wrap in DDP, train

job_id = TrainerClient().train(
    trainer=CustomTrainer(
        func=train_pytorch,
        num_nodes=4,
        resources_per_node={
            "cpu": 3,
            "memory": "16Gi",
            "gpu": 1,  # remove this line if you have no GPUs
        },
    )
)
for logline in TrainerClient().get_job_logs(job_id, follow=True):
    print(logline)

The resource values are the guide's own; its training function uses CPU with the gloo backend when CUDA is unavailable.

Tuning after Katib

The Katib overview lists Bayesian optimisation, random search and Hyperband among its algorithms, and says it integrates with Hyperopt and Optuna. The docs say its successor, OptimizationJob, is integrated with TrainJob so each trial can use Trainer runtimes, and that metrics go through the SDK and the Trainer status server, which removes the separate metrics database and collector sidecar. OptimizationJob is behind an alpha feature gate.

Kubeflow and MLflow

The two overlap only partly and can be used together:

CapabilityKubeflowMLflow
Run trackingPipelines records runs, parameters, logs and artifacts; metrics via a Metrics outputTracking: API and UI for logging parameters, code versions, metrics and output files, with a backend store and an artifact store (docs)
Model registryHub (formerly Model Registry)Versions, lineage to the producing run, aliases, tags (docs); the docs mention role-based access control only with Databricks or a managed MLflow service
Workflow orchestration on KubernetesPipelines, steps run as containers on KubernetesNot its role; scheduling is left to an orchestrator
Distributed training jobsTrainerNot its role; it records runs from whatever trains the model
Runs without KubernetesNo; the components are Kubernetes servicesYes: locally, or as a single tracking server

What it costs to run

The cost is operational; the installation page offers three routes:

  • Standalone subprojects. Subprojects can be deployed as standalone services; the Pipelines README also describes a standalone deployment.
  • The community distribution. Installed from the kubeflow/community-distribution repository; the page recommends the latest stable release.
  • Packaged distributions. Maintained by third parties and listed with versions (Charmed Kubeflow 1.11, Azure 26.03 on AKS, Red Hat Open Data Hub 26.03 on OpenShift, among others). The community does not endorse or certify any of them.

The page gives no Kubernetes version, resource requirements or upgrade policy; take those from each subproject's docs.

Do you need Kubeflow?

This table summarises the comparison above; it is not a benchmark.

Your situationChoiceWhy
No Kubernetes cluster, or no one to operate oneMLflow, or neitherThe Kubeflow components are Kubernetes services; MLflow runs locally or as a single tracking server
You need run tracking and a model registry onlyMLflowIt covers both without a cluster
Scheduled, recorded pipelines on a cluster you already runKubeflow Pipelines, standaloneSteps run as containers, and runs, parameters and artifacts are recorded
One node or one GPU is no longer enough for trainingKubeflow TrainerTrainJobs run distributed PyTorch and other frameworks on the cluster
Several people need one record of model versions, on KubernetesHub or MLflow registryBoth keep versions; match the rest of your stack
New hyperparameter search workNot Katib; OptimizationJob with careKatib is deprecated, and OptimizationJob is behind an alpha feature gate
A multi-user platform with a central dashboardKubeflow distributionThe case the full install is for, at higher operating cost

Pitfalls

  • The cache key is undocumented. Caching is on by default. The caching guide says outputs are reused if a component runs again with the same inputs and parameters and the output is still available, but not whether the component code or image is part of the key. For steps whose code changes often, disable caching with task.set_caching_options(False).
  • Lightweight components install at runtime. packages_to_install runs before your function, which must be self-contained: imports go inside its body. The docs recommend containerised Python components for production, to avoid that install step.
  • KFP 2.x and 3.0 differ in Argo support. The README says the 3.0 branch supports Argo Workflows 4.0.x and 4.1.x and not 3.x, so operators must upgrade their controller to a supported 4.x release first. The 2.x branches, including the 2.18.2 used above, have their own documented compatibility; read the matching branch before you install.
  • Standalone still has dependencies. The Pipelines README lists MySQL and Argo Workflows among its dependencies even for a standalone deployment.
  • The MLflow integration is experimental. The installation page lists it among the experimental projects with the status "Progressing" and warns that such projects may not be ready for wider adoption. Test it first.

Sources