"Should we use Ray or Kubernetes?" is the wrong shape of question, and answering it as either-or produces wrong architectures. Ray is a distributed-compute runtime; Kubernetes is an infrastructure orchestrator; production teams overwhelmingly run the first on the second. This page gives you the layer model that makes the comparison coherent, the three deployment patterns with their fit conditions, and the rule for how this question relates to the Slurm-versus-Kubernetes decision your HPC colleagues are having.
Two Layers, One Stack
Ray and Kubernetes occupy different layers: Kubernetes orchestrates infrastructure — containers, nodes, scheduling, recovery — while Ray provides the distributed-compute runtime that scales Python workloads like training, tuning, and serving across machines, which is why the production standard is Ray running on Kubernetes rather than a choice between them.
| Responsibility | Kubernetes layer | Ray layer |
| Unit of management | Containers and nodes | Python tasks, actors, training jobs |
| Core services | Scheduling, service discovery, recovery, autoscaling of pods | Distributed execution, actor state, data-parallel training and tuning |
| What it knows about ML | Nothing — it schedules generic workloads | Native — training, hyperparameter tuning, batch inference, serving APIs |
| Failure domain | Node and pod lifecycle | Task and job retry within the application |

The layer assignment explains what each side of the comparison is actually selling. Kubernetes documentation and practitioners describe exactly this division — official guidance walks running Ray as the compute runtime on Kubernetes with queueing layered on top, and engineering teams describe Kubernetes as the platform with Ray on top of it for distributed compute. The blurry edge is serving: Ray Serve and Kubernetes-native serving both run inference, and classifying where your workload's scaling logic lives (in Python code versus in container orchestration) resolves which side of that edge it belongs on.
Three Patterns and Their Fit Conditions
Three patterns cover the field: Ray alone for single-team Python workloads scaling from one machine without platform needs; Kubernetes alone for serving-centric estates whose workloads are container-native; and Ray-on-Kubernetes for platform teams that need Ray's compute model plus Kubernetes' autoscaling, gang scheduling, quotas, and multi-tenancy — the combined pattern buying enterprise features at the cost of operating two systems.
| Pattern | Fits when | What it costs |
| Ray standalone | Single team, Python-native training and batch work, scaling from one machine to a small cluster | You manage Ray's lifecycle without platform tooling beneath |
| Kubernetes alone | Container-native services and serving, no distributed-Python compute model needed | Standard platform operations; no Ray to operate at all |
| Ray on Kubernetes | Platform teams serving multiple ML groups who need quotas, multi-tenancy, gang scheduling, autoscaling | Two systems' operating surface: platform ops plus Ray lifecycle |
Cloud and vendor coverage documents the combined pattern's value proposition precisely: Ray-on-Kubernetes brings scheduling controls, scaling features, and multi-tenancy to Ray workloads, and platform builds pair Ray with ecosystem tooling above Kubernetes. The pattern table's honesty item is the cost column — the enterprise features are real, and so is the second system. Teams that choose the combined pattern for a single workload are buying multi-tenancy they will never populate; the pattern earns its complexity when several teams share the platform.
Where Slurm Fits in the Same Question
No — Slurm-vs-Kubernetes is the scheduler question for HPC-heritage estates, while Ray is a compute-runtime question that can sit above either: Python-native ML teams gravitate to Ray regardless of the scheduler beneath, and the two comparisons share only the Kubernetes half.
- Two different questions: "which scheduler manages the cluster" (Slurm or Kubernetes) and "which runtime runs the distributed workload" (Ray or framework-native execution) — a team can answer them independently.
- Heritage decides the order: HPC-heritage estates answer the scheduler question first because Slurm already runs their simulations; ML-native estates answer the runtime question first because their code is Python.
- Ray's territory versus Slurm's: Ray covers training, tuning, and ML data processing with a Python-first model; Slurm retains simulation and batch-queue workloads that predate and surround the ML estate.
Practically: an estate running Slurm for simulations can still run Ray for its ML platform where the two coexist, and an estate standardizing on Kubernetes still decides separately whether its Python workloads need Ray's runtime. Keeping the questions separate prevents the common committee error — bundling "Ray versus Slurm versus Kubernetes" into one decision and arguing across layers that were never in competition.
FAQ
Do we need Ray if we already run Kubernetes?
Only if your workloads are Python-native distributed compute that outgrows container scaling — training, tuning, batch inference written against Ray's model. If your workloads are container-native services, Kubernetes alone is the simpler answer; Ray earns its place with the workload, not the trend.
Is Ray a Slurm replacement?
For ML-native teams, largely yes at the compute layer: Ray covers the training-and-tuning territory Slurm served in HPC-heritage shops, with a Python-first model instead of batch-queue semantics — but HPC simulation fleets keep Slurm, which is why the two comparisons (scheduler versus runtime) stay separate.
What does operating Ray-on-Kubernetes actually cost?
Two systems' worth of operational attention: Kubernetes platform operations plus Ray cluster lifecycle, versioning, and debugging across the boundary — the pattern buys autoscaling, quotas, and multi-tenancy, and the honest budget for those features is the second system's operating load.