feat(k8s): minimal kubectl launcher mirroring slurm#2419
Draft
Conversation
Adds K8sConfig (sibling to SlurmConfig) and rl_k8s dispatch in the RL entrypoint. The launcher writes per-component TOMLs, renders a single multi-doc YAML manifest via Jinja that embeds the TOMLs in a ConfigMap, and `kubectl apply -f`s it. Manifest contains one StatefulSet per role (trainer / inference / orchestrator), headless services for stable DNS, and a shared PVC for outputs. Scope is intentionally small for review: multi-node only, one pod per inference replica (no router fanout), no disagg PD. Existing Helm chart under k8s/ is untouched as the legacy hand-driven path. Usage: uv run rl @ examples/reverse_text/rl.toml @ examples/reverse_text/k8s_rl.toml Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a k8s launcher path that mirrors the existing slurm flow: same
RLConfig, new[k8s]block, single Jinja template, onekubectl applyto submit.The point of this PR is to share the design with the team for early feedback — scope is intentionally small.
How it works
rl_k8s()writestrainer.toml/orchestrator.toml/inference.tomlto./k8s-runs/<job>/configs/(analog ofwrite_subconfigsin slurm).templates/rl.k8s.yaml.j2with those TOMLs inlined as a ConfigMap (data.trainer.toml: |block scalar)./etc/prime-rl/configs/and the PVC at/data.kubectl apply -f <manifest>.Trainer rendezvous via
<job>-trainer-0.<job>-trainer-headless:29500. Orchestrator getsINFER_URLSenv from the headless inference service DNS pattern.File map (5 changed + 1 gitignore)
src/prime_rl/configs/shared.pyK8sConfigsrc/prime_rl/configs/rl.pyk8sfield, mutex with slurm, template auto-load, allow multi-node + k8ssrc/prime_rl/entrypoints/rl.pyrl_k8s(),write_k8s_manifest(), dispatch inrl()src/prime_rl/templates/rl.k8s.yaml.j2examples/reverse_text/k8s_rl.toml.gitignorek8s-runs/Scope cuts (call out for review)
rl_local.ibv_devinfo; on k8s we rely on the GPU operator. May need an env block later.k8s/Helm chart left untouched as the legacy hand-driven path. Plan is to delete once this lands and disagg/router are ported.yaml.safe_load_all(8 docs render, ConfigMap contains rendered TOMLs, trainer args reference/etc/prime-rl/configs/trainer.toml,INFER_URLSresolves correctly).kubectl --dry-run=clientwould catch schema issues but isn't installed in my env.