Skip to content

[Feature] Ray Autoscaler integration with Kubernetes gang scheduling and workload lifecycle management #5002

Description

@OneSizeFitsQuorum

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

Motivation

KubeRay already supports integration with Kubernetes batch schedulers such as Volcano for gang scheduling.

However, as Ray workloads become more dynamic and elastic, there are still open questions around how Ray Autoscaler should interact with external schedulers when both components influence workload lifecycle.

Today we have multiple control loops:

  • Ray Autoscaler

    • manages Ray worker group scaling
    • decides when to add/remove resources based on Ray workload demand
  • Kubernetes scheduler / Volcano

    • manages pod placement
    • performs gang scheduling
    • handles preemption and resource reclamation

These components may make independent decisions about the same workload, which can lead to unexpected behaviors during dynamic resource changes.


Example Scenario

Consider a Ray cluster running on a heterogeneous Kubernetes cluster:

  • CPU-only nodes
  • GPU nodes

Initially, due to resource availability, some CPU Ray worker pods may be scheduled onto GPU nodes.

Later, a GPU workload arrives and requires those GPU nodes.

Ideally:

  1. The scheduler identifies that GPU workloads have higher priority.

  2. CPU worker pods are preempted from GPU nodes.

  3. CPU workers are rescheduled onto CPU nodes.

  4. Ray Autoscaler adjusts node groups accordingly:

    • scale down unused GPU capacity
    • scale up CPU capacity if needed

However, during this transition:

  • Ray workers may temporarily disappear.
  • Ray Autoscaler may interpret missing workers as insufficient capacity and scale out.
  • The scheduler may keep the workload waiting due to gang constraints.
  • The workload PodGroup may enter an InQueue state.

This creates potential conflicts between scheduler decisions and Ray Autoscaler decisions.


Open Questions

1. How should Ray Autoscaler react to scheduler-driven pod lifecycle changes?

When a Ray worker pod disappears because of scheduler actions:

  • preemption
  • eviction
  • gang scheduling transition

Should Ray Autoscaler:

  • immediately treat it as a missing worker and create replacement capacity?
  • wait for the scheduler to complete rescheduling?
  • distinguish between workload failure and scheduler-driven migration?

Is there a recommended signal/mechanism for Ray Autoscaler to understand the reason behind worker changes?


2. Should Ray Autoscaler be aware of gang scheduling states?

For workloads requiring a minimum number of workers:

Example:

desired workers: 10
running workers: 6
PodGroup: InQueue

Currently, Ray Autoscaler may see missing workers and attempt scaling actions.

Should Ray Autoscaler:

  • understand external scheduler admission states?
  • avoid scaling while the workload is waiting for gang admission?
  • coordinate with scheduler-provided signals such as PodGroup status?

3. What is the recommended ownership boundary between KubeRay and external schedulers?

Possible models:

Scheduler-driven model

Volcano/Kueue owns:

  • placement
  • admission
  • preemption

Ray Autoscaler only reacts to final cluster state.

Questions:

  • How does Ray avoid overreacting to temporary scheduler states?

Ray-aware model

Ray Autoscaler understands:

  • gang requirements
  • scheduler constraints
  • migration events

Questions:

  • Should KubeRay expose additional integration points?
  • Should Ray workload requirements be propagated to Kubernetes scheduling frameworks?

Goal

The goal is to define a better integration model between:

  • KubeRay / Ray Autoscaler
  • Kubernetes gang schedulers (Volcano, Kueue, etc.)
  • Kubernetes cluster autoscaling

for elastic Ray workloads.

This is not limited to distributed training workloads. The same challenges may appear in:

  • Ray placement groups
  • actor workloads with resource dependencies
  • mixed CPU/GPU clusters
  • dynamic workload rebalancing

We would appreciate feedback from the community on the recommended architecture and potential improvements.

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions