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.
- Kubeflow Trainer deleted its per-framework custom resources and replaced them with one TrainJob plus an administrator-defined runtime.
- A runtime is data: framework behavior is assembled at reconcile time by an ordered chain of plugins that mutate a shared Info object.
- A custom API linter turns Kubernetes conventions into a CI gate, which is what lets a single generic schema serve every framework without rotting.
- Because every framework produces the same job shape, schedulers like Kueue and Volcano integrate once instead of once per framework.
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.
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.
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.
- 2017: TFJob, the first Kubeflow training custom resource.
- Following years: framework-specific operators for PyTorch, MXNet, MPI, and XGBoost.
- 2021: consolidation into Training Operator v1.
- 2024 onward: the v2 rewrite around TrainJob, runtimes, and the plugin chain.
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.
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.
- nophase: no Phase enum on status; use Conditions instead.
- maxlength: every string and array must declare a bound.
- nodurations: explicit units over metav1.Duration.
- requiredfields, optionalorrequired, nonullable: explicit markers on every field.
- statussubresource: status must be a subresource.
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.
| Project | What it is | Central abstraction | Who configures it |
|---|---|---|---|
| Kubeflow Trainer | Kubernetes-native training job API | TrainJob + runtime + plugin chain | Both: admin authors runtimes, practitioner submits jobs |
| Ray Train | Python-first distributed execution | Ray actors and trainers | ML practitioner |
| TorchX | PyTorch launcher across backends | Component and scheduler abstraction | ML practitioner |
| Flyte | Typed workflow orchestration | Workflow DAG | Both |
| Argo Workflows | Kubernetes workflow engine | Workflow DAG and container steps | Platform admin |
| Volcano | Kubernetes batch scheduler | Batch queue and gang scheduling | Platform admin |
| Determined AI | Integrated training platform | Experiment | ML 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.





