Skip to content

Commit

Permalink
[Doc][KubeRay] Improve KubeRay docs based on CUJ (part 2) (#45304)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 authored May 14, 2024
1 parent b0ddb8e commit 2fa6663
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion doc/source/cluster/key-concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The worker that runs the Python script is known as the *driver* of the job.
There are two ways to run a Ray job on a Ray cluster:

1. (Recommended) Submit the job using the :ref:`Ray Jobs API <jobs-overview>`.
2. Run the driver script directly on any node of the Ray cluster, for interactive development.
2. Run the driver script directly on the Ray cluster, for interactive development.

For details on these workflows, refer to the :ref:`Ray Jobs API guide <jobs-overview>`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Step 1: Create a Kubernetes cluster with Kind

```sh
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

## Step 2: Install KubeRay operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This guide shows you how to manage and interact with Ray clusters on Kubernetes.

## Preparation

* Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) (>= 1.23), [Helm](https://helm.sh/docs/intro/install/) (>= v3.4), and [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation).
* Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) (>= 1.23), [Helm](https://helm.sh/docs/intro/install/) (>= v3.4), [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation), and [Docker](https://docs.docker.com/engine/install/).
* Make sure your Kubernetes cluster has at least 4 CPU and 4 GB RAM.

## Step 1: Create a Kubernetes cluster
Expand Down Expand Up @@ -143,7 +143,7 @@ See the job you submitted in Step 4 in the **Recent jobs** pane as shown below.
## Step 6: Cleanup

```sh
# [Step 5.1]: Delete the RayCluster CR
# [Step 6.1]: Delete the RayCluster CR
# Uninstall the RayCluster Helm chart
helm uninstall raycluster
# release "raycluster" uninstalled
Expand All @@ -155,7 +155,7 @@ kubectl get pods
# NAME READY STATUS RESTARTS AGE
# kuberay-operator-7fbdbf8c89-pt8bk 1/1 Running 0 XXm
# [Step 5.2]: Delete the KubeRay operator
# [Step 6.2]: Delete the KubeRay operator
# Uninstall the KubeRay operator Helm chart
helm uninstall kuberay-operator
# release "kuberay-operator" uninstalled
Expand All @@ -164,6 +164,6 @@ helm uninstall kuberay-operator
kubectl get pods
# No resources found in default namespace.
# [Step 5.3]: Delete the Kubernetes cluster
# [Step 6.3]: Delete the Kubernetes cluster
kind delete cluster
```
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ To understand the following content better, you should understand the difference
## Step 1: Create a Kubernetes cluster with Kind

```sh
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

## Step 2: Install the KubeRay operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A RayService manages these components:
## Step 1: Create a Kubernetes cluster with Kind

```sh
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

## Step 2: Install the KubeRay operator
Expand All @@ -40,11 +40,7 @@ Please note that the YAML file in this example uses `serveConfigV2` to specify a
## Step 3: Install a RayService

```sh
# Step 3.1: Download `ray-service.sample.yaml`
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/release-1.1.1/ray-operator/config/samples/ray-service.sample.yaml

# Step 3.2: Create a RayService
kubectl apply -f ray-service.sample.yaml
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-service.sample.yaml
```

## Step 4: Verify the Kubernetes cluster status
Expand Down Expand Up @@ -114,7 +110,7 @@ curl -X POST -H 'Content-Type: application/json' rayservice-sample-serve-svc:800

```sh
# Delete the RayService.
kubectl delete -f ray-service.sample.yaml
kubectl delete -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-service.sample.yaml

# Uninstall the KubeRay operator.
helm uninstall kuberay-operator
Expand Down
4 changes: 2 additions & 2 deletions doc/source/cluster/kubernetes/k8s-ecosystem/ingress.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ kubectl wait --namespace ingress-nginx \
# Step 3: Install KubeRay operator and CRD
helm repo add kuberay https://ray-project.github.io/kuberay-helm/
helm repo update
helm install kuberay-operator kuberay/kuberay-operator --version 1.0.0
helm install kuberay-operator kuberay/kuberay-operator --version 1.1.1

# Step 4: Install RayCluster and create an ingress separately.
# More information about change of setting was documented in https://github.com/ray-project/kuberay/pull/699
# and `ray-operator/config/samples/ray-cluster.separate-ingress.yaml`
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/v1.0.0/ray-operator/config/samples/ray-cluster.separate-ingress.yaml
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-cluster.separate-ingress.yaml
kubectl apply -f ray-operator/config/samples/ray-cluster.separate-ingress.yaml

# Step 5: Check the ingress created in Step 4.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/cluster/kubernetes/k8s-ecosystem/kubeflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The [Kubeflow](https://www.kubeflow.org/) project is dedicated to making deploym
## Step 1: Create a Kubernetes cluster with Kind.
```sh
# Kubeflow is sensitive to Kubernetes version and Kustomize version.
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
kustomize version --short
# 3.2.0
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Then, the KubeRay operator deletes the Pods in the `workersToDelete` field.
### Step 1: Create a Kubernetes cluster with Kind

```bash
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

### Step 2: Install the KubeRay operator
Expand All @@ -65,8 +65,7 @@ Follow [this document](kuberay-operator-deploy) to install the latest stable Kub
### Step 3: Create a RayCluster custom resource with autoscaling enabled

```bash
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/release-1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml
kubectl apply -f ray-cluster.autoscaler.yaml
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml
```

### Step 4: Verify the Kubernetes cluster status
Expand All @@ -89,7 +88,7 @@ kubectl get configmaps
```

The RayCluster has one head Pod and zero worker Pods. The head Pod has two containers: a Ray head container and a Ray Autoscaler sidecar container.
Additionally, the [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/release-1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) includes a ConfigMap named `ray-example` that houses two Python scripts: `detached_actor.py` and `terminate_detached_actor`.py.
Additionally, the [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/v1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) includes a ConfigMap named `ray-example` that houses two Python scripts: `detached_actor.py` and `terminate_detached_actor`.py.

* `detached_actor.py` is a Python script that creates a detached actor which requires 1 CPU.
```py
Expand Down Expand Up @@ -249,7 +248,7 @@ kubectl logs $HEAD_POD -c autoscaler | tail -n 20

```bash
# Delete RayCluster and ConfigMap
kubectl delete -f ray-cluster.autoscaler.yaml
kubectl delete -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml

# Uninstall the KubeRay operator
helm uninstall kuberay-operator
Expand All @@ -258,7 +257,7 @@ helm uninstall kuberay-operator
(kuberay-autoscaling-config)=
## KubeRay Autoscaling Configurations

The [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/release-1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) used in the quickstart example contains detailed comments about the configuration options.
The [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/v1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) used in the quickstart example contains detailed comments about the configuration options.
***It's recommended to read this section in conjunction with the YAML file.***

### 1. Enabling autoscaling
Expand Down Expand Up @@ -322,7 +321,7 @@ for container environment variables.
The Ray Autoscaler reads the `rayStartParams` field or the Ray container's resource limits in the RayCluster custom resource specification to determine the Ray Pod's resource requirements.
The information regarding the number of CPUs is essential for the Ray Autoscaler to scale the cluster.
Therefore, without this information, the Ray Autoscaler would report an error and fail to start.
Take [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/release-1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) as an example below:
Take [ray-cluster.autoscaler.yaml](https://github.com/ray-project/kuberay/blob/v1.1.1/ray-operator/config/samples/ray-cluster.autoscaler.yaml) as an example below:

* If users set `num-cpus` in `rayStartParams`, Ray Autoscaler would work regardless of the resource limits on the container.
* If users don't set `rayStartParams`, the Ray container must have a specified CPU resource limit.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/cluster/kubernetes/user-guides/helm-chart-rbac.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The operator has cluster-scoped access to create and manage resources, using Clu

```shell
# Create a Kubernetes cluster using Kind.
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0

# Create namespaces.
kubectl create ns n1
Expand Down Expand Up @@ -96,7 +96,7 @@ The operator has Role and RoleBinding in the same namespace.

```shell
# Create a Kubernetes cluster using Kind.
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
# Create namespaces.
kubectl create ns n1
Expand Down Expand Up @@ -151,7 +151,7 @@ Case 3 creates Role and RoleBinding for multiple namespaces, allowing a single K

```shell
# Create a Kubernetes cluster using Kind.
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
# Create namespaces.
kubectl create ns n1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See {ref}`Ray Serve end-to-end fault tolerance documentation <serve-e2e-ft-guide
### Step 1: Create a Kubernetes cluster with Kind

```sh
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

### Step 2: Install the KubeRay operator
Expand Down
2 changes: 1 addition & 1 deletion doc/source/cluster/kubernetes/user-guides/pod-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This tutorial requires several files in the repository.

```bash
# Path: kuberay/
kind create cluster --config ray-operator/config/security/kind-config.yaml --image=kindest/node:v1.24.0
kind create cluster --config ray-operator/config/security/kind-config.yaml --image=kindest/node:v1.26.0
```

The `kind-config.yaml` enables audit logging with the audit policy defined in `audit-policy.yaml`. The `audit-policy.yaml`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
### Step 1: Create a Kubernetes cluster with Kind

```sh
kind create cluster --image=kindest/node:v1.23.0
kind create cluster --image=kindest/node:v1.26.0
```

### Step 2: Install the KubeRay operator
Expand Down
8 changes: 2 additions & 6 deletions doc/source/cluster/kubernetes/user-guides/rayservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ Note that the YAML file in this example uses `serveConfigV2` to specify a multi-
## Step 3: Install a RayService

```sh
# Step 3.1: Download `ray-service.sample.yaml`
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/release-1.1.1/ray-operator/config/samples/ray-service.sample.yaml

# Step 3.2: Create a RayService
kubectl apply -f ray-service.sample.yaml
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.1/ray-operator/config/samples/ray-service.sample.yaml
```

* First, look at the Ray Serve configuration `serveConfigV2` embedded in the RayService YAML. Notice two high-level applications: a fruit stand app and a calculator app. Take note of some details about the fruit stand application:
Expand Down Expand Up @@ -183,7 +179,7 @@ curl -X POST -H 'Content-Type: application/json' rayservice-sample-serve-svc:800

You can update the configurations for the applications by modifying `serveConfigV2` in the RayService configuration file. Reapplying the modified configuration with `kubectl apply` reapplies the new configurations to the existing RayCluster instead of creating a new RayCluster.

Update the price of mangos from `3` to `4` for the fruit stand app in [ray-service.sample.yaml](https://github.com/ray-project/kuberay/blob/release-1.1.1/ray-operator/config/samples/ray-service.sample.yaml). This change reconfigures the existing MangoStand deployment, and future requests will use the updated Mango price.
Update the price of mangos from `3` to `4` for the fruit stand app in [ray-service.sample.yaml](https://github.com/ray-project/kuberay/blob/v1.1.1/ray-operator/config/samples/ray-service.sample.yaml). This change reconfigures the existing MangoStand deployment, and future requests will use the updated Mango price.

```sh
# Step 7.1: Update the price of mangos from 3 to 4.
Expand Down

0 comments on commit 2fa6663

Please sign in to comment.