Kubeflow Trainer Replaced Every Job CRD With One Plugin Chain

The Kubernetes training platform deleted PyTorchJob, TFJob, and MPIJob, then rebuilt their behavior as composable plugins. The bet is that one generic job object can serve every framework, scheduler, and backend.

9 min read • View on GitHub • More from kubeflow

An editorial illustration in black ink shows a lone operator at a large mechanical switchboard, one hand on a single lever. Behind a glass wall, a wide factory floor holds many different machines, a lathe, a press, a loom, and a drill, all running at once, with bundles of wires running from the switchboard through the glass to every machine. The image explains the core idea of Kubeflow Trainer: one interface and one job object driving many different training frameworks at the same time.
One lever, one interface, many machines. The TrainJob is the lever; the plugin chain is the wiring.
Key Takeaways

Kubeflow Trainer Bet Against Its Own API

For most of its life, running training on Kubernetes through Kubeflow meant picking a custom resource that matched your framework. PyTorch users submitted a PyTorchJob. TensorFlow users submitted a TFJob. MPI, XGBoost, and MXNet each had their own. Every one shipped with its own controller, its own status type, and its own reconciliation loop.

Trainer v2 deleted all five. In their place is a single TrainJob object, a set of reusable runtime templates, and a plugin chain that assembles framework behavior when a job is reconciled.

The split is deliberate and role-based. A platform administrator authors a TrainingRuntime (namespace-scoped) or ClusterTrainingRuntime (cluster-scoped) that encodes how a framework should run. An ML practitioner submits a TrainJob that says what to run and how many nodes, without touching the cluster plumbing underneath. The runtime is the administrator's contract; the job is the practitioner's request.

The KF Trainer v2 addresses this by separating the infrastructure configuration from the training job definition.

Kubeflow Trainer contributors, Project authors, announcement · Kubeflow Trainer v2 introduction

The payoff is integration surface. Every scheduler that wants to admit a training job now speaks to one object shape rather than five. Kueue, Volcano, KAI Scheduler, and the Slurm Bridge each integrate once. The cost is that framework-specific edge cases no longer live in a dedicated controller. They live in plugin ordering, which is a subtler thing to reason about.

The API group is still v1alpha1, even at v2.x release numbers. The team deleted a surface that users had grown to depend on and replaced it with an explicitly unstable one. That is a documented tradeoff, not an oversight.

How One Job Becomes Many

The mechanism that makes the deletion survivable lives in pkg/runtime/framework/. A TrainJob references a runtime. That runtime declares an ordered list of plugins. Each plugin reads and mutates a shared Info object as the chain runs.

The torch plugin contributes rendezvous environment variables like MASTER_ADDR and WORLD_SIZE. The mpi plugin generates SSH wiring and an MPI hostfile. The jobset and lws plugins turn the accumulated state into a concrete workload spec. By the end of the chain, the Info object is a fully formed JobSet or LeaderWorkerSet definition.

A close-up editorial illustration in black ink shows a single metal workpiece moving along a conveyor belt past three stations. The first station stamps serial numbers into the workpiece, the second bolts on a small pressure gauge, and the third attaches a bundle of thin cables that lead off-frame. The workpiece is half-finished and visibly accumulating parts, and a foreman's hand rests on a lever at the far right. The image makes concrete how a chain of plugins mutates one shared object in order, with each station adding its own contribution.
The workpiece is the shared Info object. Each station adds a part. Order is the conveyor.

A runtime is data. Pick a framework, watch the plugin chain stamp contributions into the shared Info object, and see the workload spec fall out the other side.

The ordering is not cosmetic. Each plugin can depend on what earlier plugins wrote. The MPI hostfile needs the pod list that an earlier plugin established. The controller core contains no PyTorch or MPI logic at all. It runs an ordered list of plugins over a shared object and hands the result to the workload API.

Trainer deliberately delegates multi-pod orchestration to JobSet and LeaderWorkerSet rather than reimplementing it. It focuses on the training-specific semantics (rendezvous, MPI wiring, runtime templates) and leaves gang-style pod lifecycle to upstream SIG projects. That keeps Trainer aligned with the Kubernetes ecosystem, at the price of tying its behavior to upstream API changes.

Five Operators, One Job Object

The origin is a decade of learning what the common core of distributed training actually is. Kubeflow's training work began with TFJob in 2017, when Kubernetes lacked the batch primitives that distributed ML needed.

Over the following years the project added operators for PyTorch, MXNet, MPI, and XGBoost, then consolidated them into Training Operator v1 in 2021. Each operator was a separate CRD with a separate controller.

Kubeflow Trainer is a Kubernetes-native distributed AI platform for scalable large language model (LLM) fine-tuning, hyperparameter optimization, and training of AI models across a wide range of frameworks, including PyTorch, MLX, HuggingFace, DeepSpeed, Megatron-LM, JAX, XGBoost, and more.

Kubeflow Trainer project, Project description · kubeflow/trainer README

The v2 rewrite is where the common core became explicit. Once you can name what every framework needs (a rendezvous, a host list, a pod spec, a way to report status), the framework-specific parts become plugins rather than products. The deletion was the moment the project admitted it had been building the same machine five times.

The Linter That Guards the Schema

One generic schema only works if it stays disciplined. Trainer enforces that discipline in CI with a custom golangci-lint build that bundles kube-api-linter (KAL), configured in .golangci-kal.yml and scoped to pkg/apis/*.

The rules matter more than the tooling. nophase forbids a Phase enum on status and requires Kubernetes-style Conditions. maxlength forces a bound on every string and array in the schema. nodurations discourages metav1.Duration in favor of explicit units.

This is one of the few Kubernetes projects where API-convention linting runs as a CI gate rather than a review note. It is the quiet reason a single generic schema can serve every framework without rotting, because the conventions that make CRDs hard to change later are machine-checked before they land.

What It Is Not

Trainer is a Kubernetes-native job API. It is not a Python-first execution engine, not a scheduler, not a workflow engine, and not a full ML platform. It is the layer that bridges frameworks to cluster operations.

ProjectWhat it isCentral abstractionWho configures it
Kubeflow TrainerKubernetes-native training job APITrainJob + runtime + plugin chainBoth: admin authors runtimes, practitioner submits jobs
Ray TrainPython-first distributed executionRay actors and trainersML practitioner
TorchXPyTorch launcher across backendsComponent and scheduler abstractionML practitioner
FlyteTyped workflow orchestrationWorkflow DAGBoth
Argo WorkflowsKubernetes workflow engineWorkflow DAG and container stepsPlatform admin
VolcanoKubernetes batch schedulerBatch queue and gang schedulingPlatform admin
Determined AIIntegrated training platformExperimentML practitioner

The last column is the real differentiator. Trainer is unusual in splitting configuration cleanly between the platform admin who owns the runtime and the practitioner who owns the job. That division is exactly what the runtime abstraction exists to support.

A Repo Built for Agents

The repository is written to be worked on by coding agents. It ships AGENTS.md, CLAUDE.md, and .github/copilot-instructions.md, a .agents/skills/ directory with skills like add-new-crd and review-pr, and a multi-persona PR review pipeline.

The review pipeline includes agents named for the jobs they do: silent-failure-hunter, type-design-analyzer, pr-test-analyzer, and code-simplifier. The guardrails are written as contributor docs, not only as tool configuration, which makes the expectations legible to humans and agents alike.

There is a tension worth naming. AGENTS.md tells agents not to commit large autogenerated files, yet the repo ships a large generated Python Kubernetes model set under api/python_api/. The rule and the layout disagree, a small sign of how fast agent-facing conventions are still evolving even in a project this disciplined about everything else.