Ray Clusters are in beta. Features and behavior may change before general availability.
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 rank0is the Ray head node.NUM_NODES: the configured number of nodes in the cluster.- Hostnames
node-0throughnode-Nin/etc/hosts, one for each member of the cluster. The head node is alwaysnode-0.
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 ofrunpod/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, callPOST /v2/clusters with type set to RAY and templateId set to the Ray Cluster template, or your own template built from the supported image:
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 withray job submit or a Python driver.
my_job.py as a Ray job.
For light, per-job dependencies, use Ray’s runtime environments instead of building a new image:
py_executable:
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 port8266. 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.
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.
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: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
8265or20217for 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:
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 statuson 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 withFROM 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: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
- Deploy your first Ray Cluster.
- Serve a model across the cluster with vLLM and LiteLLM.
- Review Instant Cluster environment variables and networking.
- Attach a network volume to share data and environments across nodes.