Skip to content

Commit

Permalink
[Doc][KubeRay] Update RayCluster and RayJob's Quickstart Doc to v1.1.…
Browse files Browse the repository at this point in the history
…0-rc.0

Signed-off-by: Yicheng-Lu-llll <[email protected]>
  • Loading branch information
Yicheng-Lu-llll authored Mar 4, 2024
1 parent e195272 commit f79a9a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Deploy the KubeRay operator with the [Helm chart repository](https://github.com/
helm repo add kuberay https://ray-project.github.io/kuberay-helm/
helm repo update

# Install both CRDs and KubeRay operator v1.0.0.
helm install kuberay-operator kuberay/kuberay-operator --version 1.0.0
# Install both CRDs and KubeRay operator v1.1.0-rc.0.
helm install kuberay-operator kuberay/kuberay-operator --version 1.1.0-rc.0

# Confirm that the operator is running in the namespace `default`.
kubectl get pods
Expand All @@ -43,13 +43,13 @@ Once the KubeRay operator is running, we are ready to deploy a RayCluster. To do

```sh
# Deploy a sample RayCluster CR from the KubeRay Helm chart repo:
helm install raycluster kuberay/ray-cluster --version 1.0.0
helm install raycluster kuberay/ray-cluster --version 1.1.0-rc.0

# Once the RayCluster CR has been created, you can view it by running:
kubectl get rayclusters

# NAME DESIRED WORKERS AVAILABLE WORKERS STATUS AGE
# raycluster-kuberay 1 1 ready 72s
# NAME DESIRED WORKERS AVAILABLE WORKERS CPUS MEMORY GPUS STATUS AGE
# raycluster-kuberay 1 1 2 3G 0 ready 95s
```

The KubeRay operator will detect the RayCluster object. The operator will then start your Ray cluster by creating head and worker pods. To view Ray cluster's pods, run the following command:
Expand Down
31 changes: 12 additions & 19 deletions doc/source/cluster/kubernetes/getting-started/rayjob-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ Follow the [RayCluster Quickstart](kuberay-operator-deploy) to install the lates
## Step 3: Install a RayJob

```sh
# Step 3.1: Download `ray-job.sample.yaml`
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/ray-operator/v1.1.0-alpha.0/ray-operator/config/samples/ray-job.sample.yaml

# Step 3.2: Create a RayJob
kubectl apply -f ray-job.sample.yaml
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.0-rc.0/ray-operator/config/samples/ray-job.sample.yaml
```

## Step 4: Verify the Kubernetes cluster status
Expand All @@ -75,8 +71,8 @@ kubectl apply -f ray-job.sample.yaml
kubectl get rayjob

# [Example output]
# NAME AGE
# rayjob-sample 7s
# NAME JOB STATUS DEPLOYMENT STATUS START TIME END TIME AGE
# rayjob-sample Running 2024-03-02T19:09:15Z 96s

# Step 4.2: List all RayCluster custom resources in the `default` namespace.
kubectl get raycluster
Expand Down Expand Up @@ -145,21 +141,19 @@ The Python script `sample_code.py` used by `entrypoint` is a simple Ray script t
## Step 6: Delete the RayJob

```sh
kubectl delete -f ray-job.sample.yaml
kubectl delete -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.0-rc.0/ray-operator/config/samples/ray-job.sample.yaml
```

## Step 7: Create a RayJob with `shutdownAfterJobFinishes` set to true

```sh
# Step 7.1: Download `ray-job.shutdown.yaml`
curl -LO https://raw.githubusercontent.com/ray-project/kuberay/ray-operator/v1.1.0-alpha.0/ray-operator/config/samples/ray-job.shutdown.yaml

# Step 7.2: Create a RayJob
kubectl apply -f ray-job.shutdown.yaml
kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.0-rc.0/ray-operator/config/samples/ray-job.shutdown.yaml
```

The `ray-job.shutdown.yaml` defines a RayJob custom resource with `shutdownAfterJobFinishes: true` and `ttlSecondsAfterFinished: 10`.
Hence, the KubeRay operator deletes the RayCluster and the submitter 10 seconds after the Ray job finishes.
Hence, the KubeRay operator deletes the RayCluster 10 seconds after the Ray job finishes. Note that the submitter job is not deleted
because it contains the ray job logs and does not use any cluster resources once completed. In addition, the submitter job will always
be cleaned up when the RayJob is eventually deleted due to its owner reference back to the RayJob.

## Step 8: Check the RayJob status

Expand All @@ -169,20 +163,19 @@ kubectl get rayjobs.ray.io rayjob-sample-shutdown -o jsonpath='{.status.jobDeplo
kubectl get rayjobs.ray.io rayjob-sample-shutdown -o jsonpath='{.status.jobStatus}'
```

## Step 9: Check if the KubeRay operator deletes the RayCluster and the submitter
## Step 9: Check if the KubeRay operator deletes the RayCluster

```sh
# List the RayCluster custom resources in the `default` namespace. The RayCluster and the submitter Kubernetes
# Job associated with the RayJob `rayjob-sample-shutdown` should be deleted.
# List the RayCluster custom resources in the `default` namespace. The RayCluster
# associated with the RayJob `rayjob-sample-shutdown` should be deleted.
kubectl get raycluster
kubectl get jobs
```

## Step 10: Clean up

```sh
# Step 10.1: Delete the RayJob
kubectl delete -f ray-job.shutdown.yaml
kubectl delete -f https://raw.githubusercontent.com/ray-project/kuberay/v1.1.0-rc.0/ray-operator/config/samples/ray-job.shutdown.yaml

# Step 10.2: Delete the KubeRay operator
helm uninstall kuberay-operator
Expand Down

0 comments on commit f79a9a7

Please sign in to comment.