training-operator icon indicating copy to clipboard operation
training-operator copied to clipboard

feat(manifests): Support high availability for the controller manager in the Helm chart

Open myselfkunal opened this issue 2 months ago • 5 comments

What you would like to be added?

Add three opt-in Helm values so the controller manager can run highly available:

  • manager.podDisruptionBudget: renders a PDB for manager pods. Disabled by default. The chart fails with a clear error if enabled with replicas < 2, since a PDB on a single replica blocks node drains.
  • manager.topologySpreadConstraints: spreads replicas across nodes/zones. Empty by default.
  • manager.priorityClassName: passed through to the pod spec. Empty by default (the chart won't create a PriorityClass).

No behavior change for existing installs. I'll add helm-unittest cases and a short HA note in the chart README.

manager:
  replicas: 2
  podDisruptionBudget:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: ScheduleAnyway
      labelSelector:
        matchLabels:
          app.kubernetes.io/name: kubeflow-trainer
          app.kubernetes.io/component: manager
  priorityClassName: platform-critical

Why is this needed?

Leader election is already enabled, so the manager supports multiple replicas, but the chart has no way to keep them alive during disruptions. Since the webhooks default to failurePolicy: Fail, any moment with no ready manager pod means all TrainJob / TrainingRuntime creates and updates are rejected. This happens during routine operations:

  • kubectl drain or autoscaler scale-down evicts the single default replica.
  • With 2 replicas, both can land on the same node and be evicted together.
  • On GPU clusters, the manager runs at priority 0 and can be preempted by high-priority training pods.

manager.affinity exists, but there's no documented HA path. Charts like cert-manager and ingress-nginx expose these same values.

Related but different: #3304 covers PDBs for training pods; #3345 covers a NetworkPolicy for the status server.

Open question: I'll check that built-in webhook cert management works with replicas > 1 on a multi-node kind cluster before opening a PR.

Happy to implement this if the approach looks good.

Love this feature?

Give it a 👍 We prioritize the features with most 👍

myselfkunal avatar Sep 19 '26 20:09 myselfkunal

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first issue! We're happy to have you as part of our community 🚀

Here's what happens next:

  • Our team will review your issue soon! cc @kubeflow/kubeflow-trainer-team
  • If you'd like to contribute to this issue, check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.

Join the community:

Feel free to ask questions in the comments if you need any help or clarification! Thanks again for contributing to Kubeflow! 🙏

github-actions[bot] avatar Sep 19 '26 20:09 github-actions[bot]

cc: @andreyvelich

myselfkunal avatar Sep 19 '26 20:09 myselfkunal

/remove-label needs-triage /area deployment

Thanks for raising this @myselfkunal!

This sounds like a good addition.

Please can you ensure the default helm chart values are backwards compatible- eg. Pdb disabled by default, priorityClassName empty by default.

Is there a reason to prefer topologySpreadConstraint over podAntiAffinity for spreading by on hostname? Other charts (eg kyverno, cert-manager) provide a default for anti affinity and empty topology spread list - I suspect because overriding a default item in a list is more awkward.

robert-bell avatar Sep 20 '26 18:09 robert-bell

Thanks @robert-bell!

Defaults stay backwards compatible, PDB off, priorityClassName empty, topologySpreadConstraints empty, so helm template renders exactly what it does today.

Good point on the lists, happy to follow that pattern. Helm replaces lists wholesale, so a default hostname entry would force people to re-declare it just to add a zone rule, while affinity is replaced as one block. A soft preferred anti-affinity also keeps single-node kind/minikube clusters working. I'd still expose topologySpreadConstraints (empty, with a README example) since maxSkew zone spreading isn't expressible as preferred anti-affinity.

Two things before I start:

  • manager.affinity is {} today behind a with block, so shipping a default does change rendered output for existing installs , scheduling preference only, never blocks a pod. Ship it, or keep it empty and document the block?
  • And for a PDB with replicas: 1 , fail the template with a clear message, or just a README warning? I lean towards failing, since a stuck drain is unpleasant to debug.

Testing webhook cert behaviour with replicas > 1 on a multi-node kind cluster meanwhile.

myselfkunal avatar Sep 20 '26 19:09 myselfkunal

/assign

myselfkunal avatar Sep 20 '26 19:09 myselfkunal