# KubeRay

> Run and scale Ray clusters, jobs, and services on Kubernetes

- Category: Models & Inference / GPU & Compute Clouds
- Language: Go
- Licence: Apache-2.0
- Repository: https://github.com/ray-project/kuberay
- Website: https://docs.ray.io/en/latest/cluster/kubernetes/index.html
- Canonical page: https://ai-tldr.dev/tools/kuberay/

## In short

KubeRay is an open-source Kubernetes operator that deploys and manages Ray applications on Kubernetes. It adds three custom resources to your cluster - RayCluster, RayJob, and RayService - so you can describe Ray workloads as Kubernetes objects and let the operator handle their lifecycle. It sits in the GPU & Compute Clouds category of the Models & Inference tools and is open-source, written in Go and licensed Apache-2.0.

## Overview

KubeRay is an open-source Kubernetes operator that deploys and manages Ray applications on Kubernetes. It adds three custom resources to your cluster - RayCluster, RayJob, and RayService - so you can describe Ray workloads as Kubernetes objects and let the operator handle their lifecycle.

It is aimed at ML platform and infrastructure teams who already run Kubernetes and want to schedule distributed training, batch inference, and online model serving on Ray without managing clusters by hand. RayCluster covers long-lived clusters with autoscaling and fault tolerance, RayJob creates a cluster, runs a job, and can tear the cluster down afterward, and RayService runs a Ray Serve deployment graph with zero-downtime upgrades.

As a compute-orchestration tool, KubeRay sits between Ray and the wider Kubernetes ecosystem. It integrates with observability tools like Prometheus and Grafana, queuing systems such as Volcano, Apache YuniKorn, and Kueue, and ingress controllers, and ships optional add-ons including a kubectl plugin, an API server, and a dashboard.

## What it does

- Three custom resource definitions - RayCluster, RayJob, and RayService - to model Ray workloads as Kubernetes objects
- Full RayCluster lifecycle management, including creation, deletion, autoscaling, and fault tolerance
- RayJob automatically provisions a RayCluster, submits the job, and can delete the cluster when the job finishes
- RayService runs a Ray Serve deployment graph with zero-downtime upgrades and high availability
- Optional kubectl ray plugin (Beta) to simplify common Ray-on-Kubernetes workflows
- Integrates with the Kubernetes ecosystem: Prometheus, Grafana, Volcano, Apache YuniKorn, Kueue, and Nginx

## Getting started

Install the KubeRay operator with Helm, then deploy a RayCluster custom resource. You need a running Kubernetes cluster and Helm installed.

1. Add the KubeRay Helm repository

   Register the official KubeRay Helm repo and refresh your local cache.

```bash
helm repo add kuberay https://ray-project.github.io/kuberay-helm/
helm repo update
```

2. Install the KubeRay operator

   Install the operator and its custom resource definitions into your cluster.

```bash
helm install kuberay-operator kuberay/kuberay-operator --version 1.6.0
```

3. Deploy a RayCluster

   Create a sample Ray cluster using the ray-cluster chart. The operator manages its lifecycle from here.

```bash
helm install raycluster kuberay/ray-cluster --version 1.6.0
```

4. Explore quickstarts for jobs and services

   Follow the RayJob and RayService quickstarts in the Ray documentation to run batch jobs or serve models.

## When to use it

- Run distributed model training across many GPU nodes on Kubernetes with autoscaling
- Submit batch inference or data-processing jobs that spin up and tear down a Ray cluster automatically
- Serve LLMs and other models online with a Ray Serve deployment graph and zero-downtime upgrades
- Standardize a multi-tenant ML platform on Kubernetes that integrates with Prometheus, Grafana, and queue schedulers
