From 97264e561d13b67b07910b27496e81c8b259bb9e Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Tue, 17 Nov 2026 13:00:11 -0500 Subject: [PATCH 01/20] Create documentation for Ray Clusters Added documentation for Ray Clusters, detailing usage, image variants, environment variables, and troubleshooting steps. --- instant-clusters/ray-clusters.mdx | 259 ++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 instant-clusters/ray-clusters.mdx diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx new file mode 100644 index 000000000..9bb61722a --- /dev/null +++ b/instant-clusters/ray-clusters.mdx @@ -0,0 +1,259 @@ +--- +title: Ray Clusters +sidebarTitle: Ray Clusters +description: "Run Ray on Instant Clusters with the supported Ray cluster image. Covers image variants, environment variables, ports, dashboard access, and metrics." +--- + +{/* TODO(DOCS-609): confirm release stage wording (alpha 11/17, open beta 11/23) before publishing. */} + + + +Ray Clusters are in beta. Join the [Runpod Discord](https://discord.gg/runpod) to share feedback and get support. + + + +Ray Clusters are Instant Clusters that start a [Ray](https://docs.ray.io/) cluster across every node for you. Use them to serve models that are too large for a single node with vLLM, or to run your own Ray jobs and Ray Serve applications 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 [distributed inference quickstart](/instant-clusters/ray-vllm). + +## 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 entrypoint runs the image's start command. In the inference variant, the start command serves a model with vLLM across all nodes. + +Ray, Python, CUDA, PyTorch, and vLLM versions are pinned in the image. Because the head and workers run the same image, their versions always match. + +## Image variants + +The supported image is published as pinned, versioned tags of [`runpod/ray-cluster`](https://hub.docker.com/r/runpod/ray-cluster). It comes in two variants: + +{/* TODO(DOCS-609): confirm the tag naming for each variant. Known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404. 11/12 demo: image ran Ray 2.59.0; plan is to move to Ray 2.60 for alpha, and template titles will include the Ray major.minor and CUDA versions. Add the final Ray / vLLM / CUDA versions and template names here. */} + +| Variant | Includes | Use it to | +| --- | --- | --- | +| Inference | Python, CUDA, PyTorch, Ray, and vLLM. | Serve a model across multiple nodes, configured only with environment variables. | +| Base | Python, CUDA, PyTorch, and Ray. | Submit Ray jobs, run Ray Serve applications, or work interactively over SSH or JupyterLab. | + +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](#build-a-custom-image). + +## Serve a model with the inference variant + +The inference variant serves a model without any image build. Set the model and options as environment variables in the template. + +On the head node, the start command waits until all `NUM_NODES` nodes have joined Ray, then runs `vllm serve` with: + +- Tensor parallelism set to the number of GPUs per node. +- Pipeline parallelism set to the number of nodes. + +vLLM listens on port `8000`. A front door on port `8001` forwards requests to vLLM and returns a `503` response while the model is loading. Worker nodes join Ray and run nothing else. + +vLLM runs in a `screen` session. If vLLM crashes, the Pod stays up so you can connect and debug it. + +| Variable | Default | Description | +| --- | --- | --- | +| `MODEL_REPO` | None | Hugging Face model to serve, such as `Qwen/Qwen3-235B-A22B`. Required for serving. If unset, the head node logs an error and stays available for interactive use. | +| `HF_TOKEN` | None | Hugging Face access token for gated or private models. | +| `VLLM_API_KEY` | `sk-` followed by the head Pod ID | Bearer token required on every request. Set to `none` to turn off authentication. | +| `MAX_MODEL_LENGTH` | `auto` | Passed to vLLM as the maximum model context length. | +| `VLLM_EXTRA_ARGS` | None | Extra arguments appended to `vllm serve`, such as tool call parsers or quantization flags. | + + + +Tool calling with some models requires a chat template or a tool call parser. Pass these in `VLLM_EXTRA_ARGS`, for example `--enable-auto-tool-choice --tool-call-parser hermes`. See the [vLLM tool calling guide](https://docs.vllm.ai/en/latest/features/tool_calling.html) for the flags each model needs. + + + +## Run Ray jobs with the base variant + +Use the base variant when you want to run your own Ray workloads. Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver. + +```bash +# Run on the head node. +ray job submit --working-dir . -- python my_job.py +``` + +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](https://docs.ray.io/en/latest/ray-core/handling-dependencies.html) instead of building a new image: + +```bash +ray job submit \ + --working-dir . \ + --runtime-env-json '{"pip": ["datasets", "transformers"]}' \ + -- python my_job.py +``` + +Ray installs the listed packages on each node before running the job. You can also keep a virtual environment on a [network volume](/storage/network-volumes) attached to the cluster. + +To run a different command when the cluster starts, such as a Ray Serve application stored on a network volume, change the container start command in the template. The entrypoint still starts Ray before running your command. + +## Environment variables + +These variables control the supported image. Set them in the template or when you create the cluster. + +| Variable | Default | Description | +| --- | --- | --- | +| `RAY_START_EXTRA_ARGS` | None | Extra arguments for `ray start` on every node, such as `--resources` or `--object-store-memory`. Can't include `--dashboard-port` or `--metrics-export-port`. | +| `RAY_DASHBOARD_PASSWORD` | Value of `JUPYTER_PASSWORD` | Token for signing in to the Ray dashboard. | +| `JUPYTER_PASSWORD` | Set by Runpod | Token for JupyterLab on the head node. Also used for the Ray dashboard when `RAY_DASHBOARD_PASSWORD` is unset. | +| `GRAFANA_PASSWORD` | Ray dashboard token | Token for the Grafana instance on the head node. | +| `RAY_CLUSTER_METRICS` | `1` | Set to `0` to turn off the Prometheus and Grafana metrics stack on the head node. | + +Runpod also sets `NODE_RANK`, `NUM_NODES`, and the standard cluster variables on every Pod. See the [Instant Clusters configuration reference](/instant-clusters/configuration) for the full list. + +{/* TODO(DOCS-609): confirm GRAFANA_PASSWORD default ships with STO-1246, and confirm whether JUPYTER_PASSWORD is set automatically on the head Pod. */} + +## Ports + +The head node exposes the following HTTP ports through the [Runpod proxy](/pods/configuration/expose-ports). Worker nodes expose only non-HTTP ports such as SSH. + +| Port | Node | Service | +| --- | --- | --- | +| `8266` | Head | Ray dashboard, behind token authentication. | +| `8888` | Head | JupyterLab. | +| `8889` | Head | Grafana, behind token authentication. | +| `8001` | Head | vLLM API front door (inference variant). | + +The console's links to the Ray dashboard, JupyterLab, and Grafana include your token, so you're signed in when you open them. + +{/* TODO(DOCS-609): the 11/12 demo template exposed only 8266, 8888, and 8889 on the head. Confirm whether the inference variant's template also maps 8001 (or 8000) before publishing the 8001 row. */} + +The following ports are reserved inside every Ray Cluster Pod. Don't use them for your own services: + +| Port | Purpose | +| --- | --- | +| `8265` | Ray dashboard. Unauthenticated and never exposed directly. | +| `20217` | Ray metrics endpoint on every node. | +| `6379` | Ray GCS, used by workers to join the head node. | + +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: + + + + Go to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and select your Ray Cluster. + + + Select the head Pod (rank `0`), then click **Connect**. + + + Click **Ray Dashboard**. The console opens the dashboard with your token, and the dashboard sets a session cookie so you stay signed in. + + + +{/* TODO(DOCS-609): verify console labels for the cluster card link and the Connect modal against the live console (STO-1112). */} + +To open the dashboard from a URL instead, append your token as a query parameter: + +```text +https://HEAD_POD_ID-8266.proxy.runpod.net/?token=RAY_DASHBOARD_PASSWORD +``` + +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, plus vLLM serving metrics on the inference variant. + +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. 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. + +{/* TODO(DOCS-609): remove this note once STO-1246 ships, if the single ?token= link signs in to Grafana too. */} + + + +If the **Metrics** tab is empty, open Grafana on port `8889` with the same `?token=` value once, then reload the dashboard. + + + +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, a different serving framework, or a locked, reproducible production image. Start from a pinned tag of the supported image: + +```dockerfile +FROM runpod/ray-cluster:TAG + +# Add your dependencies. +RUN pip install --no-cache-dir my-package==1.2.3 + +# Optional: replace the default start command. +CMD ["python", "/app/serve.py"] +``` + +Your image inherits the supported image's entrypoint 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. +- 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. + +After you push the image, create a [template](/pods/templates/manage-templates) that uses it, then select that template when you create a Ray Cluster. + +{/* TODO(DOCS-609): confirm how a customer template is marked Ray-capable in the console (STO-992 rayClusterCapable owner opt-in) and add the exact step here. */} + +## Limitations + +- Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails. +- Ray Clusters can only be created from the console. The REST API doesn't support creating Ray Clusters. +- 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. + +{/* TODO(DOCS-609): Taylor is investigating API/agent support (11/12 demo). Remove the API bullet if it ships. Remove the status bullet once the console readout is fixed. */} + +## Troubleshooting + +### Cluster creation fails with an image error + +{/* TODO(DOCS-609): in the 11/12 demo this showed as a pod initialization "image pull error". Taylor plans to make the message more specific. Confirm the final text before publishing. */} + +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: + +```bash +ray status +``` + +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. + +### Requests return `503` + +The model is still loading. Large models can take several minutes to download and load across all nodes. To follow progress, connect to the head node and attach to the vLLM session with `screen -r`. + +### 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 a Ray Cluster for distributed inference with vLLM](/instant-clusters/ray-vllm). +- [Review Instant Cluster environment variables and networking](/instant-clusters/configuration). +- [Attach a network volume](/storage/network-volumes) to share models and data across nodes. From 5fdb4e25dc266225d312d98cb23ecadccdd9dfee Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Tue, 17 Nov 2026 13:01:07 -0500 Subject: [PATCH 02/20] Revise Ray and vLLM deployment tutorial Updated the tutorial for deploying a Ray Cluster with vLLM, including changes to the title, sidebar title, and description. Revised sections for clarity and added new requirements and steps. --- instant-clusters/ray-vllm.mdx | 277 +++++++++++++--------------------- 1 file changed, 104 insertions(+), 173 deletions(-) diff --git a/instant-clusters/ray-vllm.mdx b/instant-clusters/ray-vllm.mdx index 70cc359c5..afd90226d 100644 --- a/instant-clusters/ray-vllm.mdx +++ b/instant-clusters/ray-vllm.mdx @@ -1,234 +1,165 @@ --- -title: "Deploy an Instant Cluster with Ray and vLLM" -sidebarTitle: "Ray + vLLM" -description: "Deploy a Runpod Cluster with Ray and vLLM to serve distributed inference across multiple nodes, including setup, networking, and validation." -tag: BETA +title: Deploy a Ray Cluster for distributed inference with vLLM +sidebarTitle: Ray and vLLM quickstart +description: "Deploy a Ray Cluster on Runpod and serve a large language model across multiple nodes with vLLM, configured only with environment variables." --- -This tutorial shows how to use Instant Clusters with Ray to run distributed inference on large language models. By combining Ray's cluster management with vLLM's tensor and pipeline parallelism, you can serve models that exceed the memory of a single node — for example, a 70B parameter model across multiple 8×H100 pods. - -Ray handles the cluster topology; vLLM uses it to split the model across GPUs both within each node (tensor parallelism) and across nodes (pipeline parallelism). +{/* TODO(DOCS-609): confirm release stage wording (alpha 11/17, open beta 11/23) before publishing. */} - Distributed inference with Ray and vLLM on Instant Clusters is currently in beta. Join our [Discord](https://discord.gg/runpod) to provide feedback and get support. - ---- +Ray Clusters are in beta. Join the [Runpod Discord](https://discord.gg/runpod) to share feedback and get support. -## Requirements + -- A Runpod account with sufficient credits for a multi-node cluster -- Basic familiarity with large language model inference and distributed GPU setups +This tutorial shows you how to serve a large language model across multiple GPU nodes using a [Ray Cluster](/instant-clusters/ray-clusters). The supported Ray cluster image starts Ray on every node and runs vLLM for you, so you configure the deployment with environment variables and never build an image or run a startup script. ---- +vLLM splits the model across GPUs within each node with tensor parallelism, and across nodes with pipeline parallelism. This lets you serve models that don't fit in the memory of a single node. -## Step 1: Deploy an Instant Cluster +## What you'll learn -1. Open the [Instant Clusters page](https://console.runpod.io/instant-clusters). -2. Click **Create Cluster**. -3. Name your cluster and configure it. For this walkthrough, set **Pod Count** to **2** and select **8× H100 SXM GPUs** per pod. Use the **Runpod PyTorch** template as your base image. +In this tutorial, you'll learn how to: - - Increase `/dev/shm` when configuring your pod. The default (64 MB) is too small for large tensor-parallel workloads. Set it to at least 8 GB. In the pod configuration, add the environment variable `MALLOC_ARENA_MAX=1` and set `--shm-size` to `8g` in your Docker run options. - +- Create a Ray Cluster with the Ray Cluster template. +- Configure the model to serve with environment variables. +- Check that every node has joined the Ray cluster. +- Send requests to the OpenAI-compatible vLLM API. +- Monitor the cluster in the Ray dashboard. -4. Click **Deploy Cluster**. You are redirected to the Instant Clusters page. +## Requirements ---- +- A Runpod account with enough credits for a multi-node cluster. +- A [Hugging Face access token](https://huggingface.co/settings/tokens) if the model you serve is gated or private. -## Step 2: Start the Ray head on pod-0 +## Step 1: Create a Ray Cluster -The first pod (`CLUSTERNAME-pod-0`) runs the Ray head node. All other pods connect to it as workers. +{/* TODO(DOCS-609): verify every console label in this step against the live create flow (cluster type selector, template name, env var editing) once the Ray Clusters flag is on. */} -1. Click your cluster to expand the pod list. -2. Click **CLUSTERNAME-pod-0**, then click **Connect → Web Terminal**. -3. In the terminal, clone the reference scripts: +1. Open the [Instant Clusters page](https://console.runpod.io/instant-clusters) and click **Create Cluster**. +2. Select **Ray** as the cluster type. +3. Name your cluster, set **Pod Count** to **2**, and select **8x H100 SXM** as the GPU configuration for each Pod. +4. Optionally, select a [network volume](/storage/network-volumes) to share model weights across nodes. +5. Confirm that the **Ray Cluster** template is selected. The console selects it automatically for Ray Clusters. Ray Clusters only accept the supported Ray cluster image or images built from it. +6. Click **Edit Template** and add the following environment variables: - ```bash - {/* [STO-463] Replace with canonical repo URL once scripts are published. */} - git clone https://github.com/runpod/ray-vllm-cluster.git - ``` + | Variable | Value | + | --- | --- | + | `MODEL_REPO` | `Qwen/Qwen3-235B-A22B` | + | `HF_TOKEN` | Your Hugging Face token, if the model is gated. | -4. Run the head startup script: + You can also set `VLLM_API_KEY`, `MAX_MODEL_LENGTH`, and `VLLM_EXTRA_ARGS`. See [serve a model with the inference variant](/instant-clusters/ray-clusters#serve-a-model-with-the-inference-variant) for every option. - ```bash - bash ray-vllm-cluster/head.sh - ``` +7. Click **Deploy Cluster**. - The script sets the correct NIC address and starts Ray: +Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pods are workers. - ```bash - # head.sh (excerpt — see full script in the repo) - export RAY_NODE_IP_ADDRESS=$(hostname -I | awk '{print $1}') - export VLLM_HOST_IP=$RAY_NODE_IP_ADDRESS - - ray start --head \ - --node-ip-address=$RAY_NODE_IP_ADDRESS \ - --port=6379 \ - --num-gpus=$NUM_TRAINERS - ``` - - - `RAY_NODE_IP_ADDRESS` and `VLLM_HOST_IP` must be set to the pod's internal network IP — not `0.0.0.0`. Setting them prevents Ray and vLLM from binding to the wrong interface on multi-NIC pods. - +## Step 2: Check that the cluster is ready ---- +Each Pod starts Ray as soon as its container starts. Workers wait for the head node, then join. After every node has joined, the head node starts vLLM. -## Step 3: Join the worker pods to the cluster +The status shown on the cluster card reflects the requested cluster, not whether Ray is ready. Use `ray status` on the head node to check that every node has joined. -Repeat this for each remaining pod in the cluster (`pod-1`, `pod-2`, …). +{/* TODO(DOCS-609): remove the sentence above once the console status readout reflects actual readiness (raised in the 11/12 demo). */} -1. In the Instant Clusters page, click the next pod and open its **Web Terminal**. -2. Clone the same scripts: +1. On the Instant Clusters page, expand your cluster and select the head Pod (rank `0`). +2. Click **Connect**, then open a **Web Terminal**. +3. Check the state of the Ray cluster: ```bash - {/* [STO-463] Replace with canonical repo URL once scripts are published. */} - git clone https://github.com/runpod/ray-vllm-cluster.git + ray status ``` -3. Run the worker startup script: - - ```bash - bash ray-vllm-cluster/worker.sh + When both nodes have joined, the output lists 2 healthy nodes and 16 GPUs: + + ```text + ======== Autoscaler status: 2026-11-17 10:00:00 ======== + Node status + --------------------------------------------------------------- + Active: + 1 node_... + 1 node_... + ... + Resources + --------------------------------------------------------------- + Usage: + 0.0/16.0 GPU ``` - The script waits for the head to be reachable, then joins: +4. Attach to the vLLM session to follow model loading: ```bash - # worker.sh (excerpt — see full script in the repo) - export RAY_NODE_IP_ADDRESS=$(hostname -I | awk '{print $1}') - export VLLM_HOST_IP=$RAY_NODE_IP_ADDRESS - - # Wait for Ray head - until bash -c ">/dev/tcp/$MASTER_ADDR/6379" 2>/dev/null; do - echo "Waiting for Ray head at $MASTER_ADDR:6379..." - sleep 2 - done - - ray start \ - --address=$MASTER_ADDR:6379 \ - --node-ip-address=$RAY_NODE_IP_ADDRESS \ - --num-gpus=$NUM_TRAINERS + screen -r ``` - `$MASTER_ADDR` is injected automatically by Runpod into all pods in the cluster — it resolves to `pod-0`. - ---- - -## Step 4: Verify the cluster - -Run this on `pod-0` to confirm all nodes have joined: - -```bash -ray status -``` - -Expected output for a two-pod cluster with 8 GPUs each: + Press `Ctrl+A`, then `D`, to detach without stopping vLLM. -``` -======== Autoscaler status: ... ======== -Node status ---------------------------------------------------------------- -Healthy: - 2 node(s) with resources: {"GPU": 8.0, ...} -``` +{/* TODO(DOCS-609): confirm the screen session name used by the inference variant, and replace the sample ray status output with real output from a 2-node test cluster. */} -You can also open the Ray dashboard. The console shows the dashboard port in the **Connect** dialog for `pod-0`. +Downloading and loading a large model across nodes can take several minutes. vLLM is ready when its log shows that the API server has started. ---- +## Step 3: Send a request -## Step 5: Launch distributed inference with vLLM +The head node exposes the vLLM API through the Runpod proxy on port `8001`. While the model is loading, this port returns a `503` response. -Run this on `pod-0` only. vLLM uses the Ray cluster that is already running. +Every request needs the API key in `VLLM_API_KEY`. If you didn't set one, the default is `sk-` followed by the head Pod's ID, for example `sk-abc123xyz`. -```bash -bash ray-vllm-cluster/serve.sh -``` +1. List the models served by the cluster: -The script launches vLLM with tensor parallelism across GPUs within each node and pipeline parallelism across nodes: - -```bash -# serve.sh (excerpt — see full script in the repo) -python -m vllm.entrypoints.openai.api_server \ - --model meta-llama/Meta-Llama-3-70B \ - --tensor-parallel-size $NUM_TRAINERS \ # GPUs per node (e.g., 8) - --pipeline-parallel-size $NUM_NODES \ # number of nodes (e.g., 2) - --host 0.0.0.0 \ - --port 8000 -``` + ```bash + curl https://HEAD_POD_ID-8001.proxy.runpod.net/v1/models \ + -H "Authorization: Bearer VLLM_API_KEY" + ``` - -`--tensor-parallel-size` should equal the number of GPUs per node (`$NUM_TRAINERS`). `--pipeline-parallel-size` should equal the number of nodes (`$NUM_NODES`). Both are injected as environment variables by Runpod. - +2. Send a chat completion request: -vLLM connects to the running Ray cluster automatically. It may take several minutes to load model weights across all nodes. + ```bash + curl https://HEAD_POD_ID-8001.proxy.runpod.net/v1/chat/completions \ + -H "Authorization: Bearer VLLM_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen3-235B-A22B", + "messages": [{"role": "user", "content": "Explain pipeline parallelism in one sentence."}] + }' + ``` ---- +Replace `HEAD_POD_ID` with the ID of the head Pod and `VLLM_API_KEY` with your API key. -## Step 6: Test the endpoint +Because the API is OpenAI-compatible, you can also use the OpenAI Python client: -Once vLLM reports that it is ready, validate from `pod-0`: +```python +from openai import OpenAI -```bash -# Check the server is healthy -curl http://localhost:8000/health +client = OpenAI( + base_url="https://HEAD_POD_ID-8001.proxy.runpod.net/v1", + api_key="VLLM_API_KEY", +) -# Confirm the model is loaded -curl http://localhost:8000/v1/models +response = client.chat.completions.create( + model="Qwen/Qwen3-235B-A22B", + messages=[{"role": "user", "content": "Explain pipeline parallelism in one sentence."}], +) +print(response.choices[0].message.content) ``` -Then send a test request: +This script points the OpenAI client at your cluster's vLLM server and prints the model's reply. -```bash -curl http://localhost:8000/v1/chat/completions \ - -H "Content-Type: application/json" \ - -d '{ - "model": "meta-llama/Meta-Llama-3-70B", - "messages": [{"role": "user", "content": "Hello!"}] - }' -``` +{/* TODO(DOCS-609): BLOCKER. In the 11/12 demo the Ray Cluster template exposed only three HTTP ports on the head (Ray dashboard, Jupyter, Grafana), with no vLLM port. Confirm whether the alpha template is the inference variant and whether it maps 8001/http. If not, this step must either add 8001 to the template's exposed ports or send requests from the head node's terminal (localhost:8000). */} ---- +## Step 4: Monitor the cluster -## Step 7: Clean up +1. Select the head Pod and click **Connect**. +2. Click **Ray Dashboard**. The console signs you in with the head node's token. +3. Open the **Cluster** tab to see live CPU, GPU, memory, and disk usage for each node. +4. Open the **Metrics** tab to see historical charts for every node and vLLM serving metrics. -When you are done, return to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and delete your cluster. Leaving it running continues to incur charges. +See [open the Ray dashboard](/instant-clusters/ray-clusters#open-the-ray-dashboard) for token details and troubleshooting. ---- - -## Environment variables reference - -Runpod injects these environment variables into every pod in the cluster. The startup scripts rely on them. - -| Variable | Description | -|---|---| -| `MASTER_ADDR` | Hostname of `pod-0`, the Ray head node | -| `MASTER_PORT` | Port for inter-node communication (default: `29500`) | -| `NUM_NODES` | Total number of pods in the cluster | -| `NUM_TRAINERS` | Number of GPUs per pod | -| `NODE_RANK` | Index of this pod (`0` for head, `1+` for workers) | - ---- +## Step 5: Clean up -## Common issues - -**Ray workers don't join** -Confirm `$MASTER_ADDR` resolves from each worker pod. Run `ping $MASTER_ADDR` in a worker terminal. If it fails, the cluster network may still be initializing — wait 30 seconds and try again. - -**vLLM OOM during model load** -Check that `/dev/shm` is large enough (at least 8 GB for 70B models). Also verify that `--tensor-parallel-size` matches the number of GPUs per node — a mismatch causes uneven shard sizes. - -**`VLLM_HOST_IP` binding error** -This error occurs when vLLM tries to bind to `0.0.0.0` on a pod with multiple network interfaces. Make sure `VLLM_HOST_IP` is set to the internal IP (`hostname -I | awk '{print $1}'`) before starting the server. - -**Stale Ray cluster after restart** -If you restart a pod, Ray does not automatically rejoin the cluster. Rerun `head.sh` on `pod-0` first, then `worker.sh` on all other pods. - ---- +When you're done, return to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and delete your cluster. A running cluster continues to incur charges. ## Next steps -- Adapt the serve script to load your own model from a [Network Volume](/storage/network-volumes) mount. -- Scale up by increasing the pod count and adjusting `--pipeline-parallel-size` accordingly. -- Try [Axolotl on an Instant Cluster](/instant-clusters/axolotl) for distributed fine-tuning. -- Review the [Instant Cluster configuration reference](/instant-clusters/configuration) for full details on environment variables and networking. +- [Learn how Ray Clusters work](/instant-clusters/ray-clusters), including the base variant for your own Ray jobs. +- [Build a custom image](/instant-clusters/ray-clusters#build-a-custom-image) from the supported Ray cluster image. +- [Attach a network volume](/storage/network-volumes) to cache model weights across deployments. From 8f2761bbdb14244170b6cee57467203d5ec05788 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Tue, 17 Nov 2026 13:15:19 -0500 Subject: [PATCH 03/20] Add ray-clusters and ray-vllm to documentation --- docs.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs.json b/docs.json index 075353564..b4a56cd28 100644 --- a/docs.json +++ b/docs.json @@ -306,6 +306,7 @@ "instant-clusters", "instant-clusters/configuration", "instant-clusters/slurm-clusters", + "instant-clusters/ray-clusters", "instant-clusters/scale-clusters", "instant-clusters/cluster-observability", { @@ -313,6 +314,7 @@ "pages": [ "instant-clusters/pytorch", "instant-clusters/axolotl", + "instant-clusters/ray-vllm", "instant-clusters/slurm" ] } From c339fb16fcf68b2e1911a00eda84cef027606eee Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Tue, 17 Nov 2026 13:18:08 -0500 Subject: [PATCH 04/20] Revise Ray Clusters documentation for beta status Updated the description and beta notice for Ray Clusters. --- instant-clusters/ray-clusters.mdx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 9bb61722a..009e1b1ad 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -2,14 +2,11 @@ title: Ray Clusters sidebarTitle: Ray Clusters description: "Run Ray on Instant Clusters with the supported Ray cluster image. Covers image variants, environment variables, ports, dashboard access, and metrics." +tag: Beta --- -{/* TODO(DOCS-609): confirm release stage wording (alpha 11/17, open beta 11/23) before publishing. */} - - -Ray Clusters are in beta. Join the [Runpod Discord](https://discord.gg/runpod) to share feedback and get support. - + Ray Clusters are in beta. Features and behavior may change before general availability. Ray Clusters are Instant Clusters that start a [Ray](https://docs.ray.io/) cluster across every node for you. Use them to serve models that are too large for a single node with vLLM, or to run your own Ray jobs and Ray Serve applications across multiple GPU nodes. From c8ee76dac50fdb0efc93632259c21b57532c7d75 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Tue, 17 Nov 2026 13:18:44 -0500 Subject: [PATCH 05/20] Revise beta notice and remove TODO comment Updated beta wording for Ray Clusters and removed TODO comment. --- instant-clusters/ray-vllm.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/instant-clusters/ray-vllm.mdx b/instant-clusters/ray-vllm.mdx index afd90226d..ad0655d7e 100644 --- a/instant-clusters/ray-vllm.mdx +++ b/instant-clusters/ray-vllm.mdx @@ -4,12 +4,8 @@ sidebarTitle: Ray and vLLM quickstart description: "Deploy a Ray Cluster on Runpod and serve a large language model across multiple nodes with vLLM, configured only with environment variables." --- -{/* TODO(DOCS-609): confirm release stage wording (alpha 11/17, open beta 11/23) before publishing. */} - - -Ray Clusters are in beta. Join the [Runpod Discord](https://discord.gg/runpod) to share feedback and get support. - + Ray Clusters are in beta. Features and behavior may change before general availability. This tutorial shows you how to serve a large language model across multiple GPU nodes using a [Ray Cluster](/instant-clusters/ray-clusters). The supported Ray cluster image starts Ray on every node and runs vLLM for you, so you configure the deployment with environment variables and never build an image or run a startup script. From 61b25f1484ff19b522e0ba4cfb2427df1984233e Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:05:52 -0500 Subject: [PATCH 06/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 69 ++++++++++--------------------- 1 file changed, 22 insertions(+), 47 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 009e1b1ad..3ff78d0c5 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -9,7 +9,7 @@ tag: Beta Ray Clusters are in beta. Features and behavior may change before general availability. -Ray Clusters are Instant Clusters that start a [Ray](https://docs.ray.io/) cluster across every node for you. Use them to serve models that are too large for a single node with vLLM, or to run your own Ray jobs and Ray Serve applications across multiple GPU nodes. +Ray Clusters are Instant Clusters that start a [Ray](https://docs.ray.io/) 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. @@ -25,53 +25,21 @@ When you create a Ray Cluster, Runpod deploys one Pod per node and gives each Po 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 entrypoint runs the image's start command. In the inference variant, the start command serves a model with vLLM across all nodes. +After Ray starts, the image starts the services on the head node: the Ray dashboard, JupyterLab, and the Grafana metrics stack. -Ray, Python, CUDA, PyTorch, and vLLM versions are pinned in the image. Because the head and workers run the same image, their versions always match. +Ray, Python, CUDA, and PyTorch versions are pinned in the image. Because the head and workers run the same image, their versions always match. -## Image variants +## The Ray cluster image -The supported image is published as pinned, versioned tags of [`runpod/ray-cluster`](https://hub.docker.com/r/runpod/ray-cluster). It comes in two variants: +The supported image is published as pinned, versioned tags of [`runpod/ray-cluster`](https://hub.docker.com/r/runpod/ray-cluster). It includes Python, CUDA, PyTorch, and Ray 2.59.0. -{/* TODO(DOCS-609): confirm the tag naming for each variant. Known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404. 11/12 demo: image ran Ray 2.59.0; plan is to move to Ray 2.60 for alpha, and template titles will include the Ray major.minor and CUDA versions. Add the final Ray / vLLM / CUDA versions and template names here. */} - -| Variant | Includes | Use it to | -| --- | --- | --- | -| Inference | Python, CUDA, PyTorch, Ray, and vLLM. | Serve a model across multiple nodes, configured only with environment variables. | -| Base | Python, CUDA, PyTorch, and Ray. | Submit Ray jobs, run Ray Serve applications, or work interactively over SSH or JupyterLab. | +{/* TODO(DOCS-609): Taylor to confirm final tag naming and template name for alpha (known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404). Add a vLLM inference variant section once that image ships. */} 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](#build-a-custom-image). -## Serve a model with the inference variant - -The inference variant serves a model without any image build. Set the model and options as environment variables in the template. - -On the head node, the start command waits until all `NUM_NODES` nodes have joined Ray, then runs `vllm serve` with: - -- Tensor parallelism set to the number of GPUs per node. -- Pipeline parallelism set to the number of nodes. - -vLLM listens on port `8000`. A front door on port `8001` forwards requests to vLLM and returns a `503` response while the model is loading. Worker nodes join Ray and run nothing else. - -vLLM runs in a `screen` session. If vLLM crashes, the Pod stays up so you can connect and debug it. - -| Variable | Default | Description | -| --- | --- | --- | -| `MODEL_REPO` | None | Hugging Face model to serve, such as `Qwen/Qwen3-235B-A22B`. Required for serving. If unset, the head node logs an error and stays available for interactive use. | -| `HF_TOKEN` | None | Hugging Face access token for gated or private models. | -| `VLLM_API_KEY` | `sk-` followed by the head Pod ID | Bearer token required on every request. Set to `none` to turn off authentication. | -| `MAX_MODEL_LENGTH` | `auto` | Passed to vLLM as the maximum model context length. | -| `VLLM_EXTRA_ARGS` | None | Extra arguments appended to `vllm serve`, such as tool call parsers or quantization flags. | - - +## Run Ray jobs -Tool calling with some models requires a chat template or a tool call parser. Pass these in `VLLM_EXTRA_ARGS`, for example `--enable-auto-tool-choice --tool-call-parser hermes`. See the [vLLM tool calling guide](https://docs.vllm.ai/en/latest/features/tool_calling.html) for the flags each model needs. - - - -## Run Ray jobs with the base variant - -Use the base variant when you want to run your own Ray workloads. Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver. +Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver. ```bash # Run on the head node. @@ -89,26 +57,33 @@ ray job submit \ -- python my_job.py ``` -Ray installs the listed packages on each node before running the job. You can also keep a virtual environment on a [network volume](/storage/network-volumes) attached to the cluster. +Ray installs the listed packages on each node before running the job. -To run a different command when the cluster starts, such as a Ray Serve application stored on a network volume, change the container start command in the template. The entrypoint still starts Ray before running your command. +You can also keep a Python virtual environment on a [network volume](/storage/network-volumes) attached to the cluster. Point Ray at the environment's Python with `py_executable`: + +```bash +ray job submit \ + --working-dir . \ + --runtime-env-json '{"py_executable": "/workspace/venv/bin/python"}' \ + -- python my_job.py +``` + +Without `py_executable`, worker nodes run your job with the container's default Python, not the virtual environment. ## Environment variables -These variables control the supported image. Set them in the template or when you create the cluster. +Set these variables in the environment variables of the template you use for the cluster. | Variable | Default | Description | | --- | --- | --- | | `RAY_START_EXTRA_ARGS` | None | Extra arguments for `ray start` on every node, such as `--resources` or `--object-store-memory`. Can't include `--dashboard-port` or `--metrics-export-port`. | +| `JUPYTER_PASSWORD` | Set by Runpod | Token for JupyterLab on the head node. Also the default token for the Ray dashboard and Grafana. | | `RAY_DASHBOARD_PASSWORD` | Value of `JUPYTER_PASSWORD` | Token for signing in to the Ray dashboard. | -| `JUPYTER_PASSWORD` | Set by Runpod | Token for JupyterLab on the head node. Also used for the Ray dashboard when `RAY_DASHBOARD_PASSWORD` is unset. | -| `GRAFANA_PASSWORD` | Ray dashboard token | Token for the Grafana instance on the head node. | +| `GRAFANA_PASSWORD` | Value of `JUPYTER_PASSWORD` | Token for the Grafana instance on the head node. | | `RAY_CLUSTER_METRICS` | `1` | Set to `0` to turn off the Prometheus and Grafana metrics stack on the head node. | Runpod also sets `NODE_RANK`, `NUM_NODES`, and the standard cluster variables on every Pod. See the [Instant Clusters configuration reference](/instant-clusters/configuration) for the full list. -{/* TODO(DOCS-609): confirm GRAFANA_PASSWORD default ships with STO-1246, and confirm whether JUPYTER_PASSWORD is set automatically on the head Pod. */} - ## Ports The head node exposes the following HTTP ports through the [Runpod proxy](/pods/configuration/expose-ports). Worker nodes expose only non-HTTP ports such as SSH. From 1f03353efb93aa3355afeb999c3fbc2d5231b5c7 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:06:34 -0500 Subject: [PATCH 07/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 3ff78d0c5..a5bc73341 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -86,19 +86,16 @@ Runpod also sets `NODE_RANK`, `NUM_NODES`, and the standard cluster variables on ## Ports -The head node exposes the following HTTP ports through the [Runpod proxy](/pods/configuration/expose-ports). Worker nodes expose only non-HTTP ports such as SSH. +The head node exposes the following HTTP ports through the [Runpod proxy](/pods/configuration/expose-ports). Each one requires a token. Worker nodes expose only non-HTTP ports such as SSH. -| Port | Node | Service | -| --- | --- | --- | -| `8266` | Head | Ray dashboard, behind token authentication. | -| `8888` | Head | JupyterLab. | -| `8889` | Head | Grafana, behind token authentication. | -| `8001` | Head | vLLM API front door (inference variant). | +| Port | Service | +| --- | --- | +| `8266` | Ray dashboard. | +| `8888` | JupyterLab. | +| `8889` | Grafana. | The console's links to the Ray dashboard, JupyterLab, and Grafana include your token, so you're signed in when you open them. -{/* TODO(DOCS-609): the 11/12 demo template exposed only 8266, 8888, and 8889 on the head. Confirm whether the inference variant's template also maps 8001 (or 8000) before publishing the 8001 row. */} - The following ports are reserved inside every Ray Cluster Pod. Don't use them for your own services: | Port | Purpose | @@ -127,7 +124,7 @@ To open the dashboard: -{/* TODO(DOCS-609): verify console labels for the cluster card link and the Connect modal against the live console (STO-1112). */} +{/* TODO(DOCS-609): once the latest main-ui changes are deployed to prod, the Ray dashboard, Grafana, and Jupyter links also appear in the cluster status bar above the head node card. Update these steps then. */} To open the dashboard from a URL instead, append your token as a query parameter: From ac848b4a07140723c3f2f8f4a4458944f0a26727 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:07:27 -0500 Subject: [PATCH 08/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 34 +++++++++---------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index a5bc73341..8ea2ce4dc 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -13,7 +13,7 @@ Ray Clusters are Instant Clusters that start a [Ray](https://docs.ray.io/) clust 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 [distributed inference quickstart](/instant-clusters/ray-vllm). +To deploy your first Ray Cluster, follow the [Ray Clusters quickstart](/instant-clusters/ray-quickstart). ## How Ray Clusters work @@ -139,41 +139,31 @@ The token is the value of `RAY_DASHBOARD_PASSWORD`, or `JUPYTER_PASSWORD` if `RA 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, plus vLLM serving metrics on the inference variant. +- **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. Retention is capped by time and size so the stack can't fill the head node's disk. +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. -{/* TODO(DOCS-609): remove this note once STO-1246 ships, if the single ?token= link signs in to Grafana too. */} - - - -If the **Metrics** tab is empty, open Grafana on port `8889` with the same `?token=` value once, then reload the dashboard. - - - 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, a different serving framework, or a locked, reproducible production image. Start from a pinned tag of the supported 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: ```dockerfile FROM runpod/ray-cluster:TAG # Add your dependencies. RUN pip install --no-cache-dir my-package==1.2.3 - -# Optional: replace the default start command. -CMD ["python", "/app/serve.py"] ``` -Your image inherits the supported image's entrypoint and the `com.runpod.ray-cluster.contract` label that Ray Clusters require. To keep your image compatible: +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. +- Don't override `CMD`. The start command runs the Ray dashboard, JupyterLab, and Grafana on the head node, and changing it breaks them. - 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. @@ -184,12 +174,12 @@ After you push the image, create a [template](/pods/templates/manage-templates) ## Limitations - Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails. -- Ray Clusters can only be created from the console. The REST API doesn't support creating Ray Clusters. +- Ray Clusters can only be created from the console. Support for creating them through the REST API is planned. - 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. -{/* TODO(DOCS-609): Taylor is investigating API/agent support (11/12 demo). Remove the API bullet if it ships. Remove the status bullet once the console readout is fixed. */} +{/* TODO(DOCS-609): remove the cluster card status bullet once the latest main-ui changes are deployed to prod (fixed, not yet deployed). Update the API bullet when API support ships. */} ## Troubleshooting @@ -213,16 +203,12 @@ ray status 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. -### Requests return `503` - -The model is still loading. Large models can take several minutes to download and load across all nodes. To follow progress, connect to the head node and attach to the vLLM session with `screen -r`. - ### 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 a Ray Cluster for distributed inference with vLLM](/instant-clusters/ray-vllm). +- [Deploy your first Ray Cluster](/instant-clusters/ray-quickstart). - [Review Instant Cluster environment variables and networking](/instant-clusters/configuration). -- [Attach a network volume](/storage/network-volumes) to share models and data across nodes. +- [Attach a network volume](/storage/network-volumes) to share data and environments across nodes. From 70d39601176ae428465c331077944cd62b376803 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:45:39 -0500 Subject: [PATCH 09/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 8ea2ce4dc..3423da142 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -1,8 +1,8 @@ --- -title: Ray Clusters -sidebarTitle: Ray Clusters -description: "Run Ray on Instant Clusters with the supported Ray cluster image. Covers image variants, environment variables, ports, dashboard access, and metrics." -tag: Beta +title: "Ray Clusters" +sidebarTitle: "Ray Clusters" +description: "Run Ray across multiple GPU nodes with Instant Clusters. Covers the Ray cluster image, environment variables, ports, dashboard access, and metrics." +tag: "Beta" --- From 685ef6af93f72aff8b22391b653dabec5423fbc3 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:47:20 -0500 Subject: [PATCH 10/20] Update Deploy your first Ray Cluster and ray-vllm - Created instant-clusters/ray-quickstart.mdx - Deleted instant-clusters/ray-vllm.mdx - Updated docs.json Mintlify-Source: dashboard-editor --- docs.json | 6 +- instant-clusters/ray-quickstart.mdx | 126 ++++++++++++++++++++++ instant-clusters/ray-vllm.mdx | 161 ---------------------------- 3 files changed, 131 insertions(+), 162 deletions(-) create mode 100644 instant-clusters/ray-quickstart.mdx delete mode 100644 instant-clusters/ray-vllm.mdx diff --git a/docs.json b/docs.json index b4a56cd28..650a184a6 100644 --- a/docs.json +++ b/docs.json @@ -314,7 +314,7 @@ "pages": [ "instant-clusters/pytorch", "instant-clusters/axolotl", - "instant-clusters/ray-vllm", + "instant-clusters/ray-quickstart", "instant-clusters/slurm" ] } @@ -2087,6 +2087,10 @@ { "source": "/integrations/transformer-lab", "destination": "/integrations/overview" + }, + { + "source": "/instant-clusters/ray-vllm", + "destination": "/instant-clusters/ray-quickstart" } ], "description": "Developer documentation for building, deploying, and scaling AI applications on Runpod.", diff --git a/instant-clusters/ray-quickstart.mdx b/instant-clusters/ray-quickstart.mdx new file mode 100644 index 000000000..fc08ad0f9 --- /dev/null +++ b/instant-clusters/ray-quickstart.mdx @@ -0,0 +1,126 @@ +--- +title: "Deploy your first Ray Cluster" +sidebarTitle: "Ray Clusters quickstart" +description: "Deploy a Ray Cluster on Runpod, run a Ray job across GPUs on multiple nodes, and watch GPU usage for every node in the Ray dashboard." +tag: "Beta" +--- + + + Ray Clusters are in beta. Features and behavior may change before general availability. + + +This tutorial shows you how to deploy a [Ray Cluster](/instant-clusters/ray-clusters) and run your first Ray job across GPUs on multiple nodes. The Ray cluster image starts Ray on every node for you, so you don't install Ray or run any startup scripts. + +## What you'll learn + +In this tutorial, you'll learn how to: + +- Create a Ray Cluster with the Ray Cluster template. +- Check that every node has joined the Ray cluster. +- Run a Ray job that uses every GPU in the cluster. +- Monitor GPU usage for each node in the Ray dashboard. + +## Requirements + +- A Runpod account with enough credits for a multi-node cluster. + +## Step 1: Create a Ray Cluster + +{/* TODO(DOCS-609): verify every console label in this step against the live create flow (cluster type selector, template name) once the Ray Clusters flag is on. */} + +1. Open the [Instant Clusters page](https://console.runpod.io/instant-clusters) and click **Create Cluster**. +2. Select **Ray** as the cluster type. +3. Name your cluster, set **Pod Count** to **2**, and select a GPU type with **2** GPUs per Pod. +4. Optionally, select a [network volume](/storage/network-volumes) to share data across nodes. +5. Confirm that the **Ray Cluster** template is selected. The console selects it automatically for Ray Clusters. +6. Click **Deploy Cluster**. + +Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pod is a worker. + +## Step 2: Check that the cluster is ready + +Each Pod starts Ray as soon as its container starts. The worker waits for the head node, then joins. + +1. On the Instant Clusters page, expand your cluster and select the head Pod (rank `0`). +2. Click **Connect**, then open a **Web Terminal**. +3. Check the state of the Ray cluster: + + ```bash + ray status + ``` + + When both nodes have joined, the output lists 2 active nodes and 4 GPUs. + +{/* TODO(DOCS-609): add real ray status output from a 2-node, 2-GPU-per-node test cluster. */} + +The status shown on the cluster card reflects the requested cluster, not whether Ray is ready. Use `ray status` to confirm that every node has joined. + +{/* TODO(DOCS-609): remove the sentence above once the latest main-ui changes are deployed to prod. */} + +## Step 3: Run a Ray job across every GPU + +In the head node's terminal, create a file named `gpu_job.py`: + +```python +import ray +import torch + +ray.init() + +@ray.remote(num_gpus=1) +def matmul(size=8192, iterations=200): + # Multiply large random matrices to keep this GPU busy. + x = torch.randn(size, size, device="cuda") + for _ in range(iterations): + x = torch.tanh(x @ x) + torch.cuda.synchronize() + return ray.util.get_node_ip_address(), torch.cuda.get_device_name(0) + +# Start one task for every GPU in the cluster. +gpu_count = int(ray.cluster_resources().get("GPU", 0)) +results = ray.get([matmul.remote() for _ in range(gpu_count)]) + +for node_ip, gpu_name in results: + print(f"Task finished on {node_ip} using {gpu_name}") +``` + +This script asks Ray how many GPUs the cluster has, then starts one task per GPU. Each task reserves one GPU (`num_gpus=1`), so Ray spreads the tasks across both nodes. When every task finishes, the script prints the node and GPU each one ran on. + +Submit the script as a Ray job: + +```bash +ray job submit --working-dir . -- python gpu_job.py +``` + +The output lists one line per GPU, with two different node addresses: + +```text +Task finished on 10.65.0.2 using NVIDIA H100 80GB HBM3 +Task finished on 10.65.0.2 using NVIDIA H100 80GB HBM3 +Task finished on 10.65.0.3 using NVIDIA H100 80GB HBM3 +Task finished on 10.65.0.3 using NVIDIA H100 80GB HBM3 +``` + +{/* TODO(DOCS-609): replace with real output from a test cluster. */} + +## Step 4: Monitor the cluster + +1. Select the head Pod and click **Connect**. +2. Click **Ray Dashboard**. The console signs you in with the head node's token. +3. Open the **Jobs** tab to see the job you submitted. +4. Open the **Cluster** tab to see live CPU, GPU, memory, and disk usage for each node. +5. Open the **Metrics** tab to see historical charts for every node. + +Run the job again while the **Metrics** tab is open to watch GPU usage rise on both nodes. Charts can lag by a minute or more. + +See [open the Ray dashboard](/instant-clusters/ray-clusters#open-the-ray-dashboard) for token details and troubleshooting. + +## Step 5: Clean up + +When you're done, return to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and delete your cluster. A running cluster continues to incur charges. + +## Next steps + +- [Learn how Ray Clusters work](/instant-clusters/ray-clusters), including environment variables and reserved ports. +- [Add dependencies to your jobs](/instant-clusters/ray-clusters#run-ray-jobs) with runtime environments or a virtual environment on a network volume. +- [Build a custom image](/instant-clusters/ray-clusters#build-a-custom-image) from the supported Ray cluster image. diff --git a/instant-clusters/ray-vllm.mdx b/instant-clusters/ray-vllm.mdx deleted file mode 100644 index ad0655d7e..000000000 --- a/instant-clusters/ray-vllm.mdx +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: Deploy a Ray Cluster for distributed inference with vLLM -sidebarTitle: Ray and vLLM quickstart -description: "Deploy a Ray Cluster on Runpod and serve a large language model across multiple nodes with vLLM, configured only with environment variables." ---- - - - Ray Clusters are in beta. Features and behavior may change before general availability. - - -This tutorial shows you how to serve a large language model across multiple GPU nodes using a [Ray Cluster](/instant-clusters/ray-clusters). The supported Ray cluster image starts Ray on every node and runs vLLM for you, so you configure the deployment with environment variables and never build an image or run a startup script. - -vLLM splits the model across GPUs within each node with tensor parallelism, and across nodes with pipeline parallelism. This lets you serve models that don't fit in the memory of a single node. - -## What you'll learn - -In this tutorial, you'll learn how to: - -- Create a Ray Cluster with the Ray Cluster template. -- Configure the model to serve with environment variables. -- Check that every node has joined the Ray cluster. -- Send requests to the OpenAI-compatible vLLM API. -- Monitor the cluster in the Ray dashboard. - -## Requirements - -- A Runpod account with enough credits for a multi-node cluster. -- A [Hugging Face access token](https://huggingface.co/settings/tokens) if the model you serve is gated or private. - -## Step 1: Create a Ray Cluster - -{/* TODO(DOCS-609): verify every console label in this step against the live create flow (cluster type selector, template name, env var editing) once the Ray Clusters flag is on. */} - -1. Open the [Instant Clusters page](https://console.runpod.io/instant-clusters) and click **Create Cluster**. -2. Select **Ray** as the cluster type. -3. Name your cluster, set **Pod Count** to **2**, and select **8x H100 SXM** as the GPU configuration for each Pod. -4. Optionally, select a [network volume](/storage/network-volumes) to share model weights across nodes. -5. Confirm that the **Ray Cluster** template is selected. The console selects it automatically for Ray Clusters. Ray Clusters only accept the supported Ray cluster image or images built from it. -6. Click **Edit Template** and add the following environment variables: - - | Variable | Value | - | --- | --- | - | `MODEL_REPO` | `Qwen/Qwen3-235B-A22B` | - | `HF_TOKEN` | Your Hugging Face token, if the model is gated. | - - You can also set `VLLM_API_KEY`, `MAX_MODEL_LENGTH`, and `VLLM_EXTRA_ARGS`. See [serve a model with the inference variant](/instant-clusters/ray-clusters#serve-a-model-with-the-inference-variant) for every option. - -7. Click **Deploy Cluster**. - -Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pods are workers. - -## Step 2: Check that the cluster is ready - -Each Pod starts Ray as soon as its container starts. Workers wait for the head node, then join. After every node has joined, the head node starts vLLM. - -The status shown on the cluster card reflects the requested cluster, not whether Ray is ready. Use `ray status` on the head node to check that every node has joined. - -{/* TODO(DOCS-609): remove the sentence above once the console status readout reflects actual readiness (raised in the 11/12 demo). */} - -1. On the Instant Clusters page, expand your cluster and select the head Pod (rank `0`). -2. Click **Connect**, then open a **Web Terminal**. -3. Check the state of the Ray cluster: - - ```bash - ray status - ``` - - When both nodes have joined, the output lists 2 healthy nodes and 16 GPUs: - - ```text - ======== Autoscaler status: 2026-11-17 10:00:00 ======== - Node status - --------------------------------------------------------------- - Active: - 1 node_... - 1 node_... - ... - Resources - --------------------------------------------------------------- - Usage: - 0.0/16.0 GPU - ``` - -4. Attach to the vLLM session to follow model loading: - - ```bash - screen -r - ``` - - Press `Ctrl+A`, then `D`, to detach without stopping vLLM. - -{/* TODO(DOCS-609): confirm the screen session name used by the inference variant, and replace the sample ray status output with real output from a 2-node test cluster. */} - -Downloading and loading a large model across nodes can take several minutes. vLLM is ready when its log shows that the API server has started. - -## Step 3: Send a request - -The head node exposes the vLLM API through the Runpod proxy on port `8001`. While the model is loading, this port returns a `503` response. - -Every request needs the API key in `VLLM_API_KEY`. If you didn't set one, the default is `sk-` followed by the head Pod's ID, for example `sk-abc123xyz`. - -1. List the models served by the cluster: - - ```bash - curl https://HEAD_POD_ID-8001.proxy.runpod.net/v1/models \ - -H "Authorization: Bearer VLLM_API_KEY" - ``` - -2. Send a chat completion request: - - ```bash - curl https://HEAD_POD_ID-8001.proxy.runpod.net/v1/chat/completions \ - -H "Authorization: Bearer VLLM_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "model": "Qwen/Qwen3-235B-A22B", - "messages": [{"role": "user", "content": "Explain pipeline parallelism in one sentence."}] - }' - ``` - -Replace `HEAD_POD_ID` with the ID of the head Pod and `VLLM_API_KEY` with your API key. - -Because the API is OpenAI-compatible, you can also use the OpenAI Python client: - -```python -from openai import OpenAI - -client = OpenAI( - base_url="https://HEAD_POD_ID-8001.proxy.runpod.net/v1", - api_key="VLLM_API_KEY", -) - -response = client.chat.completions.create( - model="Qwen/Qwen3-235B-A22B", - messages=[{"role": "user", "content": "Explain pipeline parallelism in one sentence."}], -) -print(response.choices[0].message.content) -``` - -This script points the OpenAI client at your cluster's vLLM server and prints the model's reply. - -{/* TODO(DOCS-609): BLOCKER. In the 11/12 demo the Ray Cluster template exposed only three HTTP ports on the head (Ray dashboard, Jupyter, Grafana), with no vLLM port. Confirm whether the alpha template is the inference variant and whether it maps 8001/http. If not, this step must either add 8001 to the template's exposed ports or send requests from the head node's terminal (localhost:8000). */} - -## Step 4: Monitor the cluster - -1. Select the head Pod and click **Connect**. -2. Click **Ray Dashboard**. The console signs you in with the head node's token. -3. Open the **Cluster** tab to see live CPU, GPU, memory, and disk usage for each node. -4. Open the **Metrics** tab to see historical charts for every node and vLLM serving metrics. - -See [open the Ray dashboard](/instant-clusters/ray-clusters#open-the-ray-dashboard) for token details and troubleshooting. - -## Step 5: Clean up - -When you're done, return to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and delete your cluster. A running cluster continues to incur charges. - -## Next steps - -- [Learn how Ray Clusters work](/instant-clusters/ray-clusters), including the base variant for your own Ray jobs. -- [Build a custom image](/instant-clusters/ray-clusters#build-a-custom-image) from the supported Ray cluster image. -- [Attach a network volume](/storage/network-volumes) to cache model weights across deployments. From de020398407d69ce69b5cac61f7a98726c1277a8 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:50:18 -0500 Subject: [PATCH 11/20] Update Overview - Updated instant-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instant-clusters.mdx b/instant-clusters.mdx index d8e113282..417fc5a1c 100644 --- a/instant-clusters.mdx +++ b/instant-clusters.mdx @@ -18,7 +18,7 @@ Instant Clusters provide fully managed multi-node compute with high-performance ## Get started -For distributed inference across multiple nodes, follow the [Ray and vLLM deployment guide](/instant-clusters/ray-vllm). +To run Ray workloads across multiple nodes, follow the [Ray Clusters quickstart](/instant-clusters/ray-quickstart). @@ -30,8 +30,8 @@ For distributed inference across multiple nodes, follow the [Ray and vLLM deploy Fine-tune LLMs across multiple GPUs. - - Serve models across multiple nodes with Ray and vLLM. + + Managed Ray for distributed GPU workloads. From 4c1587d887e9597337d21a5268f246ce1bc28c51 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:51:03 -0500 Subject: [PATCH 12/20] Update Overview - Updated instant-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instant-clusters.mdx b/instant-clusters.mdx index 417fc5a1c..01e12811f 100644 --- a/instant-clusters.mdx +++ b/instant-clusters.mdx @@ -18,7 +18,7 @@ Instant Clusters provide fully managed multi-node compute with high-performance ## Get started -To run Ray workloads across multiple nodes, follow the [Ray Clusters quickstart](/instant-clusters/ray-quickstart). +For distributed inference across multiple nodes, follow the [Ray and vLLM deployment guide](/instant-clusters/ray-vllm). @@ -30,8 +30,8 @@ To run Ray workloads across multiple nodes, follow the [Ray Clusters quickstart] Fine-tune LLMs across multiple GPUs. - - Managed Ray for distributed GPU workloads. + + Serve models across multiple nodes with Ray and vLLM. From 2b31c5c435f43bbd0e0247f8a38c7abb41b8005a Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 08:51:47 -0500 Subject: [PATCH 13/20] Update Overview - Updated instant-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instant-clusters.mdx b/instant-clusters.mdx index 01e12811f..417fc5a1c 100644 --- a/instant-clusters.mdx +++ b/instant-clusters.mdx @@ -18,7 +18,7 @@ Instant Clusters provide fully managed multi-node compute with high-performance ## Get started -For distributed inference across multiple nodes, follow the [Ray and vLLM deployment guide](/instant-clusters/ray-vllm). +To run Ray workloads across multiple nodes, follow the [Ray Clusters quickstart](/instant-clusters/ray-quickstart). @@ -30,8 +30,8 @@ For distributed inference across multiple nodes, follow the [Ray and vLLM deploy Fine-tune LLMs across multiple GPUs. - - Serve models across multiple nodes with Ray and vLLM. + + Managed Ray for distributed GPU workloads. From 559686ba5cc9aedaf5ba70fa71d62f34f6304c89 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 09:48:46 -0500 Subject: [PATCH 14/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 3423da142..d346d6a4c 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -174,7 +174,7 @@ After you push the image, create a [template](/pods/templates/manage-templates) ## Limitations - Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails. -- Ray Clusters can only be created from the console. Support for creating them through the REST API is planned. +- Ray Clusters can only be created from the console. The REST API doesn't support creating Ray Clusters. - 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. From 7141b30144e8be347c05a31e37fe51e289291254 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Wed, 18 Nov 2026 09:50:23 -0500 Subject: [PATCH 15/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index d346d6a4c..a86d1a702 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -174,7 +174,7 @@ After you push the image, create a [template](/pods/templates/manage-templates) ## Limitations - Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails. -- Ray Clusters can only be created from the console. The REST API doesn't support creating Ray Clusters. +- Ray Clusters can only be created from the console. The REST API currently doesn't support creating Ray Clusters. - 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. From 393848af0be4a63906a2243125f16cb13eead591 Mon Sep 17 00:00:00 2001 From: Taylor Burmeister Date: Wed, 18 Nov 2026 16:19:58 -0500 Subject: [PATCH 16/20] docs(instant-clusters): add a Ray Cluster inference tutorial with LiteLLM Add instant-clusters/ray-litellm.mdx, which serves a model across a Ray Cluster with the Ray Inference template (vLLM behind LiteLLM on port 4000, from runpod/containers#245) and connects Claude Code and Pi to it. - Link the new page from the Ray Clusters page, with an inference-variant section and a port 4000 row. - Add it to the nav and point the old ray-vllm redirect at it. - Update the Together AI migration guide's link. Co-Authored-By: Claude Opus 5.5 --- docs.json | 3 +- instant-clusters/ray-clusters.mdx | 12 +- instant-clusters/ray-litellm.mdx | 265 ++++++++++++++++++++++++++++++ migrate/together-ai.mdx | 2 +- 4 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 instant-clusters/ray-litellm.mdx diff --git a/docs.json b/docs.json index 650a184a6..47623df07 100644 --- a/docs.json +++ b/docs.json @@ -315,6 +315,7 @@ "instant-clusters/pytorch", "instant-clusters/axolotl", "instant-clusters/ray-quickstart", + "instant-clusters/ray-litellm", "instant-clusters/slurm" ] } @@ -2090,7 +2091,7 @@ }, { "source": "/instant-clusters/ray-vllm", - "destination": "/instant-clusters/ray-quickstart" + "destination": "/instant-clusters/ray-litellm" } ], "description": "Developer documentation for building, deploying, and scaling AI applications on Runpod.", diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index a86d1a702..a5e140e14 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -33,10 +33,18 @@ Ray, Python, CUDA, and PyTorch versions are pinned in the image. Because the hea The supported image is published as pinned, versioned tags of [`runpod/ray-cluster`](https://hub.docker.com/r/runpod/ray-cluster). It includes Python, CUDA, PyTorch, and Ray 2.59.0. -{/* TODO(DOCS-609): Taylor to confirm final tag naming and template name for alpha (known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404). Add a vLLM inference variant section once that image ships. */} +{/* TODO(DOCS-609): Taylor to confirm final tag naming and template name for alpha (known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404). */} 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](#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](https://docs.litellm.ai/) 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](/instant-clusters/ray-litellm). + +{/* TODO(DOCS-609): replace VERSION with the published tag once runpod/containers#245 ships. */} + ## Run Ray jobs Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver. @@ -93,6 +101,7 @@ The head node exposes the following HTTP ports through the [Runpod proxy](/pods/ | `8266` | Ray dashboard. | | `8888` | JupyterLab. | | `8889` | Grafana. | +| `4000` | Inference API (LiteLLM). Ray Inference template only. | The console's links to the Ray dashboard, JupyterLab, and Grafana include your token, so you're signed in when you open them. @@ -210,5 +219,6 @@ The request has no token or the wrong token. Open the dashboard from the console ## Next steps - [Deploy your first Ray Cluster](/instant-clusters/ray-quickstart). +- [Serve a model across the cluster with vLLM and LiteLLM](/instant-clusters/ray-litellm). - [Review Instant Cluster environment variables and networking](/instant-clusters/configuration). - [Attach a network volume](/storage/network-volumes) to share data and environments across nodes. diff --git a/instant-clusters/ray-litellm.mdx b/instant-clusters/ray-litellm.mdx new file mode 100644 index 000000000..2f1e98ed6 --- /dev/null +++ b/instant-clusters/ray-litellm.mdx @@ -0,0 +1,265 @@ +--- +title: "Serve a model across a Ray Cluster with vLLM and LiteLLM" +sidebarTitle: "Ray and LiteLLM inference" +description: "Serve a large language model across multiple nodes with the Ray cluster inference image, then connect Claude Code or Pi to it through LiteLLM." +tag: "Beta" +--- + + + Ray Clusters are in beta. Features and behavior may change before general availability. + + +This tutorial shows you how to serve a large language model across multiple GPU nodes using a [Ray Cluster](/instant-clusters/ray-clusters) and the inference variant of the Ray cluster image. The inference image starts Ray on every node, runs vLLM across the whole cluster, and puts a [LiteLLM](https://docs.litellm.ai/) proxy in front of it. You configure the deployment with environment variables and never build an image or run a startup script. + +vLLM splits the model across GPUs within each node with tensor parallelism, and across nodes with pipeline parallelism. This lets you serve models that don't fit in the memory of a single node. LiteLLM serves the model through both an OpenAI-compatible API and an Anthropic-compatible API, so you can point coding agents such as Claude Code and Pi at your cluster. + +## What you'll learn + +In this tutorial, you'll learn how to: + +- Create a Ray Cluster with the Ray Inference template. +- Configure the model to serve with environment variables. +- Check that the model has loaded and the API is ready. +- Send requests to the LiteLLM API. +- Connect Claude Code and Pi to your cluster. +- Monitor the cluster and the inference metrics. + +## Requirements + +- A Runpod account with enough credits for a multi-node cluster. +- A [Hugging Face access token](https://huggingface.co/settings/tokens) if the model you serve is gated or private. +- To connect a coding agent: [Claude Code](https://code.claude.com/docs/en/setup) or [Pi](https://pi.dev) installed on your local machine. + +## How the inference image works + +The inference image is published as `runpod/ray-cluster:VERSION-inference-cu1300-torch2130-ubuntu2404`. It's the supported Ray cluster image plus vLLM and LiteLLM. It keeps the same entrypoint, so Ray starts on every node exactly as it does with the base image. Only the services that run after Ray starts are different: + +- **Worker nodes** join the Ray cluster and run nothing else. +- **The head node** waits until `NUM_NODES` nodes have joined Ray, then starts vLLM on `127.0.0.1:8000`. vLLM sets tensor parallelism to the number of GPUs per node and pipeline parallelism to the number of nodes, so every node must have the same number of GPUs. +- **LiteLLM** starts on the head node once vLLM has loaded the model, and serves the API on port `4000`. + +vLLM listens only on the head node's loopback interface, so it's never reachable from outside the Pod. Every request goes through LiteLLM, which checks the API key. + +{/* TODO(DOCS-609): replace VERSION with the published tag once runpod/containers#245 ships. */} + +## Step 1: Create a Ray Cluster + +{/* TODO(DOCS-609): verify every console label in this step against the live create flow (cluster type selector, template name, environment variable editing) once the Ray Clusters flag is on. */} + +1. Open the [Instant Clusters page](https://console.runpod.io/instant-clusters) and click **Create Cluster**. +2. Select **Ray** as the cluster type. +3. Name your cluster, set **Pod Count** to **2**, and select **8x H100 SXM** as the GPU configuration for each Pod. +4. Optionally, select a [network volume](/storage/network-volumes) to share data across nodes. +5. Select the **Ray Inference** template. It uses the inference image and exposes the API on port `4000` alongside the usual Ray Cluster ports. +6. Click **Edit Template** and add the following environment variables: + + | Variable | Value | + | --- | --- | + | `MODEL_REPO` | `Qwen/Qwen3-235B-A22B-Instruct-2507` | + | `MAX_MODEL_LENGTH` | `131072` | + | `VLLM_EXTRA_ARGS` | `--enable-auto-tool-choice --tool-call-parser hermes` | + | `LITELLM_MASTER_KEY` | A secret of your choice, used as the API key. | + | `HF_TOKEN` | Your Hugging Face token, if the model is gated. | + + `VLLM_EXTRA_ARGS` turns on tool calling, which coding agents need. See [inference environment variables](#inference-environment-variables) for every option, and [the inference variant](/instant-clusters/ray-clusters#serve-a-model-with-the-inference-variant) for an overview. + +7. Click **Deploy Cluster**. + +Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pod is a worker. + +## Step 2: Check that the model is ready + +Each Pod starts Ray as soon as its container starts. The worker waits for the head node, then joins. After every node has joined, the head node starts vLLM, and after vLLM has loaded the model, the head node starts LiteLLM. + +Each node downloads its own copy of the model weights, and loading a large model across nodes can take several minutes. + +1. On the Instant Clusters page, expand your cluster and select the head Pod (rank `0`). +2. Click **Connect** and check the status of port `4000`. It shows as ready once LiteLLM is serving the model. + +{/* TODO(DOCS-609): verify the exact port status labels in the Connect view against a live inference cluster. */} + +Until port `4000` is ready, nothing listens on it, and requests to it return a `502` response from the Runpod proxy. + +## Step 3: Send a request + +The head node exposes the LiteLLM API through the Runpod proxy on port `4000`. Every request needs your `LITELLM_MASTER_KEY` as a bearer token. If you didn't set `LITELLM_MASTER_KEY`, the key is the head Pod's `JUPYTER_PASSWORD`. + +1. List the models served by the cluster: + + ```bash + curl https://HEAD_POD_ID-4000.proxy.runpod.net/v1/models \ + -H "Authorization: Bearer LITELLM_MASTER_KEY" + ``` + +2. Send a chat completion request: + + ```bash + curl https://HEAD_POD_ID-4000.proxy.runpod.net/v1/chat/completions \ + -H "Authorization: Bearer LITELLM_MASTER_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen3-235B-A22B-Instruct-2507", + "messages": [{"role": "user", "content": "Explain pipeline parallelism in one sentence."}] + }' + ``` + +Replace `HEAD_POD_ID` with the ID of the head Pod and `LITELLM_MASTER_KEY` with your API key. The model name is always the value of `MODEL_REPO`. + +Because the API is OpenAI-compatible, you can also use the OpenAI Python client: + +```python +from openai import OpenAI + +client = OpenAI( + base_url="https://HEAD_POD_ID-4000.proxy.runpod.net/v1", + api_key="LITELLM_MASTER_KEY", +) + +response = client.chat.completions.create( + model="Qwen/Qwen3-235B-A22B-Instruct-2507", + messages=[{"role": "user", "content": "Explain pipeline parallelism in one sentence."}], +) +print(response.choices[0].message.content) +``` + +This script points the OpenAI client at your cluster's LiteLLM proxy and prints the model's reply. + +A request with no key receives a `401` response. A request with the wrong key receives a `400` response with the message `No connected db.`, because LiteLLM looks up unknown keys in a database that the image doesn't run. Both requests are refused. + +## Step 4: Connect a coding agent + +LiteLLM serves the model through an Anthropic-compatible Messages API (`/v1/messages`) as well as the OpenAI-compatible API, so you can use the model on your cluster as the backend for a coding agent running on your local machine. + +Coding agents rely on tool calling and long prompts. Make sure `VLLM_EXTRA_ARGS` turns on tool calling with a parser that matches your model, and that `MAX_MODEL_LENGTH` leaves room for the agent's system prompt and your code. For example, to test the connection quickly and cheaply with a small model such as `Qwen/Qwen3-0.6B`, set: + +| Variable | Value | +| --- | --- | +| `MODEL_REPO` | `Qwen/Qwen3-0.6B` | +| `VLLM_EXTRA_ARGS` | `--enable-auto-tool-choice --tool-call-parser hermes` | + +A model this small is enough to check that the agent can reach your cluster and call tools, but use a larger model for real coding work. + + + + Claude Code sends requests to the Anthropic API by default. Point it at your cluster by setting these environment variables in your local shell: + + ```bash + export ANTHROPIC_BASE_URL="https://HEAD_POD_ID-4000.proxy.runpod.net" + export ANTHROPIC_AUTH_TOKEN="LITELLM_MASTER_KEY" + export ANTHROPIC_MODEL="Qwen/Qwen3-235B-A22B-Instruct-2507" + export ANTHROPIC_DEFAULT_HAIKU_MODEL="Qwen/Qwen3-235B-A22B-Instruct-2507" + export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 + ``` + + - `ANTHROPIC_BASE_URL` sends Claude Code's requests to LiteLLM on your head node. Don't add `/v1`, because Claude Code adds it. + - `ANTHROPIC_AUTH_TOKEN` sends your LiteLLM key as a bearer token. + - `ANTHROPIC_MODEL` and `ANTHROPIC_DEFAULT_HAIKU_MODEL` make Claude Code use your model for both its main work and its background tasks. The cluster serves only one model, so both must be the value of `MODEL_REPO`. + - `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` stops Claude Code from sending Anthropic beta headers that other models don't support. + + Then start Claude Code in your project directory: + + ```bash + claude + ``` + + Run `/status` in Claude Code to confirm that it's using your cluster's URL and model. + + To keep these settings for one project instead of your whole shell, add them to the `env` block of `.claude/settings.local.json` in the project. See [Claude Code settings](https://code.claude.com/docs/en/settings) for details. + + + [Pi](https://pi.dev) is an open-source coding agent. The community [`pi-provider-litellm`](https://github.com/balcsida/pi-provider-litellm) extension adds LiteLLM as a provider and discovers the models your proxy serves. Install Pi and the extension on your local machine: + + ```bash + npm install -g @earendil-works/pi-coding-agent + pi install npm:pi-provider-litellm + ``` + + Then connect Pi to your cluster in one of two ways: + + - **Sign in from Pi:** start `pi`, run `/login`, choose **Sign in with an API key**, then choose **LiteLLM API key**. Enter `https://HEAD_POD_ID-4000.proxy.runpod.net` as the base URL and your `LITELLM_MASTER_KEY` as the key. Pi saves them in `~/.pi/agent/auth.json`. + - **Configure a file:** add your cluster to `~/.pi/agent/models.json`: + + ```json ~/.pi/agent/models.json + { + "providers": { + "litellm": { + "baseUrl": "https://HEAD_POD_ID-4000.proxy.runpod.net", + "apiKey": "$LITELLM_MASTER_KEY" + } + } + } + ``` + + `apiKey` reads your key from the `LITELLM_MASTER_KEY` environment variable, so the key isn't stored in the file. You don't need to list models, because the extension discovers them from the proxy. + + In both cases, the base URL is the proxy root, without `/v1`. Run `/model` in Pi and select your cluster's model, or start Pi with it: + + ```bash + pi --provider litellm --model Qwen/Qwen3-235B-A22B-Instruct-2507 + ``` + + + +{/* TODO(DOCS-609): test Claude Code and Pi end to end against a live inference cluster, and confirm that LiteLLM 1.108.11 translates Claude Code's /v1/messages requests (including tool use) to vLLM without extra config. */} + +## Step 5: Monitor the cluster + +1. Select the head Pod and click **Connect**. +2. Click **Ray Dashboard**. The console signs you in with the head node's token. +3. Open the **Cluster** tab to see live CPU, GPU, memory, and disk usage for each node. +4. Open the **Metrics** tab to see historical charts for every node. + +The head node's Grafana instance also includes an **Inference** folder with vLLM's dashboards and LiteLLM's dashboard. Use them to track request rates, latency, token throughput, and cache usage. Open Grafana from the head Pod's **Connect** menu. + +See [open the Ray dashboard](/instant-clusters/ray-clusters#open-the-ray-dashboard) for token details and troubleshooting. + +## Step 6: Clean up + +When you're done, return to the [Instant Clusters page](https://console.runpod.io/instant-clusters) and delete your cluster. A running cluster continues to incur charges. + +If you connected a coding agent, unset the Claude Code environment variables, or run `/logout litellm` in Pi and remove the `litellm` block from `~/.pi/agent/models.json`, so the agent stops sending requests to the deleted cluster. + +## Inference environment variables + +Set these variables in the template you use for the cluster, in addition to the [Ray Cluster environment variables](/instant-clusters/ray-clusters#environment-variables). + +| Variable | Default | Description | +| --- | --- | --- | +| `MODEL_REPO` | None | Hugging Face model to serve, such as `Qwen/Qwen3-235B-A22B-Instruct-2507`. Also the model name clients send. If unset, the head node skips vLLM and stays up for interactive use. | +| `HF_TOKEN` | None | Hugging Face token for gated or private models. | +| `LITELLM_MASTER_KEY` | Value of `JUPYTER_PASSWORD` | API key required on every route on port `4000`, except LiteLLM's health checks (`/health/liveliness` and `/health/readiness`). Set to `none` to turn off authentication. Publicly known defaults such as `sk-1234` aren't accepted. | +| `MAX_MODEL_LENGTH` | vLLM's default | Maximum context length, passed to vLLM as `--max-model-len`. | +| `VLLM_EXTRA_ARGS` | None | Extra arguments for `vllm serve`, such as tool calling flags. Added after the default parallelism settings, so it can override them. Can't include `--api-key`. | + + + With `LITELLM_MASTER_KEY=none`, anyone who knows your head Pod's ID can send requests to your model. Only turn off authentication for short tests. + + +## Troubleshooting + +### Requests return `502` + +The model is still loading, or vLLM or LiteLLM didn't start. Check the head Pod's logs for `[ray-inference]` messages. If vLLM or LiteLLM exits, the Pod stays up so you can investigate, and the log names the cause. Fix the cause, then restart the head Pod to serve again. Workers don't rejoin a restarted head node on their own, so restart the worker Pods after the head node is back. + +### Requests return `401` or `400` with `No connected db.` + +The request has no API key or the wrong one. Send `Authorization: Bearer` with your `LITELLM_MASTER_KEY`, or the head Pod's `JUPYTER_PASSWORD` if you didn't set one. + +### vLLM doesn't start + +The head node's log says why. Common causes: + +- `MODEL_REPO` isn't set. +- Neither `LITELLM_MASTER_KEY` nor `JUPYTER_PASSWORD` is set. +- `VLLM_EXTRA_ARGS` includes `--api-key`. Remove it, because LiteLLM checks the key instead. +- The nodes have different numbers of GPUs, so vLLM can't split the model into even pipeline stages. + +### The coding agent fails on tool calls + +vLLM is running without tool calling, or with a parser that doesn't match the model. Set `VLLM_EXTRA_ARGS` to `--enable-auto-tool-choice --tool-call-parser PARSER`, using the parser that vLLM's [tool calling documentation](https://docs.vllm.ai/en/latest/features/tool_calling.html) lists for your model, then restart the head Pod and the worker Pods. + +## Next steps + +- [Learn how Ray Clusters work](/instant-clusters/ray-clusters), including the base image for your own Ray jobs. +- [Deploy your first Ray Cluster](/instant-clusters/ray-quickstart) and run a Ray job across every GPU. +- [Attach a network volume](/storage/network-volumes) to share data across nodes. diff --git a/migrate/together-ai.mdx b/migrate/together-ai.mdx index b21cadb8b..3783b1a2a 100644 --- a/migrate/together-ai.mdx +++ b/migrate/together-ai.mdx @@ -201,7 +201,7 @@ Use this table for every item in your inventory. | A fine-tuning job | A GPU Pod, the [fine-tuning Pod](/fine-tune), or `@app.task` in the Runpod SDK (one Pod per call that runs to completion). | | A Slurm GPU cluster | [Instant Cluster](/instant-clusters/slurm-clusters) with managed Slurm. | | A Kubernetes GPU cluster used for distributed training | Instant Cluster with [PyTorch](/instant-clusters/pytorch) or Slurm. | -| A Kubernetes GPU cluster used for serving | Serverless endpoints, or an Instant Cluster with [Ray and vLLM](/instant-clusters/ray-vllm) for models that span nodes. | +| A Kubernetes GPU cluster used for serving | Serverless endpoints, or an Instant Cluster with [Ray, vLLM, and LiteLLM](/instant-clusters/ray-litellm) for models that span nodes. | | A code sandbox | A Pod. | ### Model map for Public Endpoints From abd657e14f1ccbb24aca30719049b9fa19f7deb4 Mon Sep 17 00:00:00 2001 From: Taylor Burmeister Date: Thu, 19 Nov 2026 08:12:20 -0500 Subject: [PATCH 17/20] docs(instant-clusters): document handing off to /start.sh from a custom CMD Co-Authored-By: Claude Opus 5.5 --- instant-clusters/ray-clusters.mdx | 38 ++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index a5e140e14..444b5f3bb 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -172,10 +172,46 @@ RUN pip install --no-cache-dir my-package==1.2.3 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. -- Don't override `CMD`. The start command runs the Ray dashboard, JupyterLab, and Grafana on the head node, and changing it breaks them. +- If you set your own `CMD`, end it with `/start.sh`. See [run your own start command](#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`: + +```bash start.sh +#!/bin/bash +set -euo pipefail + +# Your per-boot setup. +python /opt/app/setup.py + +# Hand off to the base image's start script. +exec /start.sh +``` + +```dockerfile +FROM runpod/ray-cluster:TAG + +COPY start.sh /opt/app/start.sh +RUN chmod +x /opt/app/start.sh +CMD ["/opt/app/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`: + +```bash +if [[ "$NODE_RANK" == "0" ]]; then + serve deploy /workspace/serve_config.yaml & +fi +exec /start.sh +``` + After you push the image, create a [template](/pods/templates/manage-templates) that uses it, then select that template when you create a Ray Cluster. {/* TODO(DOCS-609): confirm how a customer template is marked Ray-capable in the console (STO-992 rayClusterCapable owner opt-in) and add the exact step here. */} From 4b784c852108402a15855ee92338ce51e88faf26 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Mon, 23 Nov 2026 14:27:05 -0500 Subject: [PATCH 18/20] Update Ray Clusters, Deploy your first Ray Cluster and 1 more page - Updated instant-clusters/ray-clusters.mdx - Updated instant-clusters/ray-quickstart.mdx - Updated instant-clusters/ray-litellm.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 48 +++++++++++++++++++++++++++-- instant-clusters/ray-litellm.mdx | 4 +++ instant-clusters/ray-quickstart.mdx | 4 +++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index 444b5f3bb..a39580932 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -45,6 +45,51 @@ The **Ray Inference** template uses this image and exposes port `4000`. You conf {/* TODO(DOCS-609): replace VERSION with the published tag once runpod/containers#245 ships. */} +## Create a Ray Cluster with the REST API + +You can also create and manage Ray Clusters with the [REST API](/api-reference-v2/clusters/create-a-cluster). Set `type` to `RAY` and pass the ID of the Ray Cluster template, or your own template built from the supported image, in `templateId`: + +```bash +curl -X POST https://api.runpod.io/v2/clusters \ + -H "Authorization: Bearer RUNPOD_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "my-ray-cluster", + "type": "RAY", + "templateId": "RAY_TEMPLATE_ID", + "compute": { + "gpuTypeId": "NVIDIA H100 80GB HBM3", + "gpuCountPerPod": 2, + "podCount": 2 + }, + "startSsh": true, + "startJupyter": true + }' +``` + +This request creates a two-node Ray Cluster with two H100 GPUs on each Pod: + +- `type`: `RAY` gives the Pods Ray roles. The Pod with rank `0` is the head node, and the others are workers. +- `templateId`: the template every Pod starts from. It can't be combined with `image`, `env`, `ports`, `args`, `entrypoint`, `cmd`, or `disk`. To set environment variables such as `RAY_START_EXTRA_ARGS` or `MODEL_REPO`, save them in your own template and pass that template's ID. +- `compute`: the shape of every Pod. `gpuTypeId` is a GPU type from `GET /v2/catalog/gpus`, and `podCount` is the number of nodes, from 2 to 250. +- `startSsh`: adds your account's SSH public key to every Pod. +- `startJupyter`: starts JupyterLab, as on Pod create. + +To choose a data center, add `dataCenterIds`. To attach a [network volume](/storage/network-volumes), add it under `mounts.network`. A cluster can mount one network volume, and global volumes aren't supported. + +{/* TODO(DOCS-609): replace RAY_TEMPLATE_ID with the public Ray Cluster template ID once it's published, and confirm whether startJupyter is needed for the dashboard tokens when creating from the API. */} + +The response includes the cluster's `id`. To find the head node, list the cluster's Pods: + +```bash +curl https://api.runpod.io/v2/clusters/CLUSTER_ID/pods \ + -H "Authorization: Bearer RUNPOD_API_KEY" +``` + +Each Pod's `cluster` object includes its `rank` and `role`. The head node has rank `0` and the role `RAY_HEAD`, and every worker has the role `RAY_WORKER`. Once the head node is running, the cluster's `primary.sshEndpoint` field (from `GET /v2/clusters/CLUSTER_ID`) gives its SSH address. + +After you create a cluster, you can only rename it with `PATCH /v2/clusters/CLUSTER_ID`. Its type, GPU type, Pod count, and template are fixed. `DELETE /v2/clusters/CLUSTER_ID` deletes the cluster and terminates every Pod in it. + ## Run Ray jobs Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver. @@ -219,12 +264,11 @@ After you push the image, create a [template](/pods/templates/manage-templates) ## Limitations - Ray Clusters run only on the supported image or an image built from it. Creating a Ray Cluster with any other image fails. -- Ray Clusters can only be created from the console. The REST API currently doesn't support creating Ray Clusters. - 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. -{/* TODO(DOCS-609): remove the cluster card status bullet once the latest main-ui changes are deployed to prod (fixed, not yet deployed). Update the API bullet when API support ships. */} +{/* TODO(DOCS-609): remove the cluster card status bullet once the latest main-ui changes are deployed to prod (fixed, not yet deployed). */} ## Troubleshooting diff --git a/instant-clusters/ray-litellm.mdx b/instant-clusters/ray-litellm.mdx index 2f1e98ed6..74d47de79 100644 --- a/instant-clusters/ray-litellm.mdx +++ b/instant-clusters/ray-litellm.mdx @@ -67,6 +67,10 @@ vLLM listens only on the head node's loopback interface, so it's never reachable Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pod is a worker. + + To create the cluster with the REST API instead, first save these environment variables in your own template based on the Ray Inference template, because a cluster request can't combine `templateId` with `env`. Then pass that template's ID. See [create a Ray Cluster with the REST API](/instant-clusters/ray-clusters#create-a-ray-cluster-with-the-rest-api). + + ## Step 2: Check that the model is ready Each Pod starts Ray as soon as its container starts. The worker waits for the head node, then joins. After every node has joined, the head node starts vLLM, and after vLLM has loaded the model, the head node starts LiteLLM. diff --git a/instant-clusters/ray-quickstart.mdx b/instant-clusters/ray-quickstart.mdx index fc08ad0f9..3d95cbfcd 100644 --- a/instant-clusters/ray-quickstart.mdx +++ b/instant-clusters/ray-quickstart.mdx @@ -37,6 +37,10 @@ In this tutorial, you'll learn how to: Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pod is a worker. + + To create the cluster from code instead, see [create a Ray Cluster with the REST API](/instant-clusters/ray-clusters#create-a-ray-cluster-with-the-rest-api). + + ## Step 2: Check that the cluster is ready Each Pod starts Ray as soon as its container starts. The worker waits for the head node, then joins. From d4ba466edd895daff9744e39da32db3820c532a4 Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Mon, 23 Nov 2026 17:20:30 -0500 Subject: [PATCH 19/20] Update Ray Clusters - Updated instant-clusters/ray-clusters.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-clusters.mdx | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/instant-clusters/ray-clusters.mdx b/instant-clusters/ray-clusters.mdx index a39580932..fe278afe8 100644 --- a/instant-clusters/ray-clusters.mdx +++ b/instant-clusters/ray-clusters.mdx @@ -47,7 +47,7 @@ The **Ray Inference** template uses this image and exposes port `4000`. You conf ## Create a Ray Cluster with the REST API -You can also create and manage Ray Clusters with the [REST API](/api-reference-v2/clusters/create-a-cluster). Set `type` to `RAY` and pass the ID of the Ray Cluster template, or your own template built from the supported image, in `templateId`: +To create a Ray Cluster from code, call [`POST /v2/clusters`](/api-reference-v2/clusters/create-a-cluster) with `type` set to `RAY` and `templateId` set to the Ray Cluster template, or your own template built from the supported image: ```bash curl -X POST https://api.runpod.io/v2/clusters \ @@ -61,34 +61,17 @@ curl -X POST https://api.runpod.io/v2/clusters \ "gpuTypeId": "NVIDIA H100 80GB HBM3", "gpuCountPerPod": 2, "podCount": 2 - }, - "startSsh": true, - "startJupyter": true + } }' ``` -This request creates a two-node Ray Cluster with two H100 GPUs on each Pod: +{/* TODO(DOCS-609): replace RAY_TEMPLATE_ID with the public Ray Cluster template ID once it's published. */} -- `type`: `RAY` gives the Pods Ray roles. The Pod with rank `0` is the head node, and the others are workers. -- `templateId`: the template every Pod starts from. It can't be combined with `image`, `env`, `ports`, `args`, `entrypoint`, `cmd`, or `disk`. To set environment variables such as `RAY_START_EXTRA_ARGS` or `MODEL_REPO`, save them in your own template and pass that template's ID. -- `compute`: the shape of every Pod. `gpuTypeId` is a GPU type from `GET /v2/catalog/gpus`, and `podCount` is the number of nodes, from 2 to 250. -- `startSsh`: adds your account's SSH public key to every Pod. -- `startJupyter`: starts JupyterLab, as on Pod create. +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 choose a data center, add `dataCenterIds`. To attach a [network volume](/storage/network-volumes), add it under `mounts.network`. A cluster can mount one network volume, and global volumes aren't supported. +To find the head node, call [`GET /v2/clusters/CLUSTER_ID/pods`](/api-reference-v2/clusters/list-a-clusters-pods). The head node's `cluster` object has rank `0` and the role `RAY_HEAD`. Workers have the role `RAY_WORKER`. -{/* TODO(DOCS-609): replace RAY_TEMPLATE_ID with the public Ray Cluster template ID once it's published, and confirm whether startJupyter is needed for the dashboard tokens when creating from the API. */} - -The response includes the cluster's `id`. To find the head node, list the cluster's Pods: - -```bash -curl https://api.runpod.io/v2/clusters/CLUSTER_ID/pods \ - -H "Authorization: Bearer RUNPOD_API_KEY" -``` - -Each Pod's `cluster` object includes its `rank` and `role`. The head node has rank `0` and the role `RAY_HEAD`, and every worker has the role `RAY_WORKER`. Once the head node is running, the cluster's `primary.sshEndpoint` field (from `GET /v2/clusters/CLUSTER_ID`) gives its SSH address. - -After you create a cluster, you can only rename it with `PATCH /v2/clusters/CLUSTER_ID`. Its type, GPU type, Pod count, and template are fixed. `DELETE /v2/clusters/CLUSTER_ID` deletes the cluster and terminates every Pod in it. +For every request field, and for renaming or deleting a cluster, see the [Clusters API reference](/api-reference-v2/clusters/create-a-cluster). ## Run Ray jobs From c9398c245d65aa8e5da06811d57b92b73bd1f74b Mon Sep 17 00:00:00 2001 From: lgunreddi Date: Mon, 23 Nov 2026 17:21:44 -0500 Subject: [PATCH 20/20] Update Serve a model across a Ray Cluster with vLLM and LiteLLM - Updated instant-clusters/ray-litellm.mdx Mintlify-Source: dashboard-editor --- instant-clusters/ray-litellm.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instant-clusters/ray-litellm.mdx b/instant-clusters/ray-litellm.mdx index 74d47de79..4e2118edd 100644 --- a/instant-clusters/ray-litellm.mdx +++ b/instant-clusters/ray-litellm.mdx @@ -68,7 +68,7 @@ vLLM listens only on the head node's loopback interface, so it's never reachable Runpod deploys one Pod per node. The Pod with rank `0` is the Ray head node, and the other Pod is a worker. - To create the cluster with the REST API instead, first save these environment variables in your own template based on the Ray Inference template, because a cluster request can't combine `templateId` with `env`. Then pass that template's ID. See [create a Ray Cluster with the REST API](/instant-clusters/ray-clusters#create-a-ray-cluster-with-the-rest-api). + To create the cluster from code instead, see [create a Ray Cluster with the REST API](/instant-clusters/ray-clusters#create-a-ray-cluster-with-the-rest-api). ## Step 2: Check that the model is ready