Skip to main content
Ray Clusters are in beta. Features and behavior may change before general availability.
Ray Clusters are Instant Clusters that start a Ray cluster across every node for you. Use them to run Ray jobs, Ray Serve applications, and other distributed workloads across multiple GPU nodes. Every Ray Cluster runs the supported Ray cluster image (runpod/ray-cluster) or an image you build from it. The image starts Ray on each node, so you don’t need to install Ray or run ray start yourself. To deploy your first Ray Cluster, follow the Ray Clusters quickstart.

How Ray Clusters work

When you create a Ray Cluster, Runpod deploys one Pod per node and gives each Pod the cluster topology:
  • NODE_RANK: the Pod’s position in the cluster. The Pod with rank 0 is the Ray head node.
  • NUM_NODES: the configured number of nodes in the cluster.
  • Hostnames node-0 through node-N in /etc/hosts, one for each member of the cluster. The head node is always node-0.
The image entrypoint uses these values to start Ray. On the head node, it runs ray start --head. On each worker, it waits until node-0 is reachable, then joins the cluster. If the head node isn’t running yet, workers keep retrying and join as soon as it comes up. After Ray starts, the image starts the services on the head node: the Ray dashboard, JupyterLab, and the Grafana metrics stack. Ray, Python, CUDA, and PyTorch versions are pinned in the image. Because the head and workers run the same image, their versions always match.

The Ray cluster image

The supported image is published as pinned, versioned tags of runpod/ray-cluster. It includes Python, CUDA, PyTorch, and Ray 2.59.0. When you create a Ray Cluster, the console selects the Ray Cluster template automatically. It uses the supported image and exposes the right ports on the head node. If you change the template’s ports, Runpod can’t guarantee that the cluster works. Use the template as is unless you need dependencies that are slow to install for every job. See build a custom image.

Serve a model with the inference variant

The inference variant of the image (runpod/ray-cluster:VERSION-inference-cu1300-torch2130-ubuntu2404) serves one Hugging Face model across every node of the cluster, with no image build. It keeps the same entrypoint, so Ray starts exactly as it does with the base image. After every node has joined, the head node runs vLLM across the whole cluster and serves the model through a LiteLLM proxy on port 4000, with OpenAI-compatible and Anthropic-compatible APIs. The Ray Inference template uses this image and exposes port 4000. You configure the model with environment variables such as MODEL_REPO and LITELLM_MASTER_KEY. To deploy it, send requests, and connect coding agents such as Claude Code, follow serve a model across a Ray Cluster with vLLM and LiteLLM.

Create a Ray Cluster with the REST API

To create a Ray Cluster from code, call POST /v2/clusters with type set to RAY and templateId set to the Ray Cluster template, or your own template built from the supported image:
To set environment variables such as RAY_START_EXTRA_ARGS, save them in your own template, because a request with templateId can’t include env. To find the head node, call GET /v2/clusters/CLUSTER_ID/pods. The head node’s cluster object has rank 0 and the role RAY_HEAD. Workers have the role RAY_WORKER. For every request field, and for renaming or deleting a cluster, see the Clusters API reference.

Run Ray jobs

Connect to the head node over SSH or JupyterLab, then submit work with ray job submit or a Python driver.
This command uploads the current directory to the cluster and runs my_job.py as a Ray job. For light, per-job dependencies, use Ray’s runtime environments instead of building a new image:
Ray installs the listed packages on each node before running the job. You can also keep a Python virtual environment on a network volume attached to the cluster. Point Ray at the environment’s Python with py_executable:
Without py_executable, worker nodes run your job with the container’s default Python, not the virtual environment.

Environment variables

Set these variables in the environment variables of the template you use for the cluster. Runpod also sets NODE_RANK, NUM_NODES, and the standard cluster variables on every Pod. See the Instant Clusters configuration reference for the full list.

Ports

The head node exposes the following HTTP ports through the Runpod proxy. Each one requires a token. Worker nodes expose only non-HTTP ports such as SSH. The console’s links to the Ray dashboard, JupyterLab, and Grafana include your token, so you’re signed in when you open them. The following ports are reserved inside every Ray Cluster Pod. Don’t use them for your own services: Ports 8265 and 20217 are fixed. If you set RAY_DASHBOARD_PORT or RAY_METRICS_PORT to a different value, or pass --dashboard-port or --metrics-export-port in RAY_START_EXTRA_ARGS, the container exits before Ray starts with an error that names the variable and the required value.

Open the Ray dashboard

The Ray dashboard runs on the head node behind a token-protected proxy on port 8266. Ray’s own dashboard port (8265) is never exposed, because it allows anyone who can reach it to submit jobs to your cluster. To open the dashboard:
1

Open your cluster

Go to the Instant Clusters page and select your Ray Cluster.
2

Connect to the head node

Select the head Pod (rank 0), then click Connect.
3

Open the dashboard

Click Ray Dashboard. The console opens the dashboard with your token, and the dashboard sets a session cookie so you stay signed in.
To open the dashboard from a URL instead, append your token as a query parameter:
The token is the value of RAY_DASHBOARD_PASSWORD, or JUPYTER_PASSWORD if RAY_DASHBOARD_PASSWORD is unset. Requests without a valid token receive a 403 response.

View cluster metrics

The Ray dashboard shows metrics in two places:
  • Cluster tab: live CPU, GPU, memory, and disk usage for each node. Available with no setup.
  • Metrics tab: historical charts for every node.
The Metrics tab is powered by a Prometheus and Grafana stack that runs on the head node. Prometheus discovers each node’s metrics endpoint automatically, and Grafana comes with Ray’s standard dashboards. When you open the Ray dashboard, it signs you in to Grafana too, so the charts load without a separate sign-in. Retention is capped by time and size so the stack can’t fill the head node’s disk. Metrics data stays on the head node, inside your cluster, and is deleted when you delete the cluster. New data takes a short time to reach the Metrics tab, so charts can lag the Cluster tab by a minute or more after a workload starts. If you already run your own monitoring stack, set RAY_CLUSTER_METRICS=0 to turn off the bundled stack. You can scrape each node’s metrics endpoint at node-RANK:20217/metrics from inside the cluster.

Build a custom image

Build your own image when you need dependencies that are slow to install for every job, or a locked, reproducible production image. Start from a pinned tag of the supported image and add your dependencies:
Your image inherits the supported image’s entrypoint, start command, and the com.runpod.ray-cluster.contract label that Ray Clusters require. To keep your image compatible:
  • Don’t override ENTRYPOINT. The entrypoint is what starts Ray on each node.
  • If you set your own CMD, end it with /start.sh. See run your own start command.
  • Don’t upgrade or downgrade Ray. The image logs a warning if the Ray version changes.
  • Don’t use ports 8265 or 20217 for your own services.

Run your own start command

The image’s default start command is /start.sh, which starts SSH, JupyterLab, the Ray dashboard proxy, and Grafana. The entrypoint starts Ray first and then runs the start command, so a custom CMD replaces /start.sh. If your command doesn’t call it, those services don’t start, and you can’t connect to any node over SSH. To run your own commands when the container starts, put them in a script that ends by handing off to /start.sh:
start.sh
/start.sh keeps running after the services start, so handing off with exec also keeps the container up. To run a long-lived process alongside the services, start it in the background before the handoff: my-app & exec /start.sh. The start command runs on every node. To run a step only on the head node, check NODE_RANK:
After you push the image, create a template that uses it, then select that template when you create a Ray Cluster.

Limitations

  • Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails.
  • The status shown on the cluster card reflects the requested cluster, not whether Ray is ready. Run ray status on the head node to check readiness.
  • Ray processes aren’t restarted automatically. If Ray exits on a node, the Pod stays up so you can connect and investigate, but that node leaves the cluster.
  • If the head node restarts, workers that were already running don’t rejoin on their own. Restart the worker Pods after the head node is back.

Troubleshooting

Cluster creation fails with an image error

The Pods fail to initialize with an error saying that Ray cluster pods require the official Ray cluster image or an image built from it. The template uses an image that isn’t the supported Ray cluster image or built from it, or the template overrides the image entrypoint. Use the Ray Cluster template, or rebuild your image with FROM runpod/ray-cluster:TAG and keep the entrypoint.

Container exits with a port error

The template or image sets a reserved port, for example “RAY_METRICS_PORT is fixed at 20217”. Remove the override and move your own service to a different port.

Workers don’t join the cluster

Connect to the head node and run:
The output lists each node that has joined. If a node is missing, check that Pod’s logs for the entrypoint output. Workers retry until node-0 is reachable, so a worker that started before the head node joins once the head node is running.

Dashboard returns 403

The request has no token or the wrong token. Open the dashboard from the console, or add ?token= with your RAY_DASHBOARD_PASSWORD (or JUPYTER_PASSWORD) value.

Next steps

Last modified on November 23, 2026