Skip to content

Commit

Permalink
[Docs][KubeRay] Add doc for kubectl plugin (ray-project#47851)
Browse files Browse the repository at this point in the history
Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
Signed-off-by: mohitjain2504 <mohit.jain@dream11.com>
  • Loading branch information
MortalHappiness authored and mohitjain2504 committed Nov 15, 2024
1 parent 084264d commit 6dfed46
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/source/cluster/kubernetes/user-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ user-guides/helm-chart-rbac
user-guides/tls
user-guides/k8s-autoscaler
user-guides/static-ray-cluster-without-kuberay
user-guides/kubectl-plugin
```


Expand Down Expand Up @@ -53,3 +54,4 @@ at the {ref}`introductory guide <kuberay-quickstart>` first.
* {ref}`kuberay-gke-bucket`
* {ref}`ray-k8s-autoscaler-comparison`
* {ref}`deploy-a-static-ray-cluster-without-kuberay`
* {ref}`kubectl-plugin`
68 changes: 68 additions & 0 deletions doc/source/cluster/kubernetes/user-guides/kubectl-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
(kubectl-plugin)=

# Use kubectl Plugin (alpha)

Starting from KubeRay v1.2.2, you can use the `kubectl ray` plugin to simplify common workflows when deploying Ray on Kubernetes. If you aren't familiar with Kubernetes, this plugin simplifies running Ray on Kubernetes.

## Installation

See [KubeRay kubectl Plugin](https://github.com/ray-project/kuberay/tree/master/kubectl-plugin) to install the plugin.

Install the Kuberay kubectl plugin using one of the following methods:

- Install using Krew kubectl plugin manager (recommended)
- Download from GitHub releases

### Install using the Krew kubectl plugin manager (recommended)

1. Install [Krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).
2. Download the plugin list by running `kubectl krew update`.
3. Install the plugin by running `kubectl krew install ray`.
4. Run `kubectl ray --help` to verify the installation.

### Download from GitHub releases

Go to the [releases page](https://github.com/ray-project/kuberay/releases) and download the binary for your platform.

For example, to install kubectl plugin version 1.2.2 on Linux amd64:

```bash
curl -LO https://github.com/ray-project/kuberay/releases/download/v1.2.2/kubectl-ray_v1.2.2_linux_amd64.tar.gz
tar -xvf kubectl-ray_v1.2.2_linux_amd64.tar.gz
cp kubectl-ray ~/.local/bin
```

Replace `~/.local/bin` with the directory in your `PATH`.

## Usage

After installing the plugin, you can use `kubectl ray --help` to see the available commands and options.

## Example

This example assumes you have a Ray cluster running on Kubernetes. See {ref}`RayCluster Quickstart <kuberay-raycluster-quickstart>` if you don't have a Ray cluster running on Kubernetes.

### Forward local ports to Ray cluster

```shell
$ kubectl ray session ray-cluster-kuberay

Forwarding ports to service ray-cluster-kuberay-head-svc
Ray Dashboard: http://localhost:8265
Ray Interactive Client: http://localhost:10001

Forwarding from 127.0.0.1:8265 -> 8265
Forwarding from [::1]:8265 -> 8265
Forwarding from 127.0.0.1:10001 -> 10001
Forwarding from [::1]:10001 -> 10001
```

### Get Ray cluster logs

```shell
$ kubectl ray logs rayjob-sample-raycluster-kfhl6
No output directory specified, creating dir under current directory using cluster name.
Command set to retrieve both head and worker node logs.
Downloading log for Ray Node rayjob-sample-raycluster-kfhl6-head-87xpb
Downloading log for Ray Node rayjob-sample-raycluster-kfhl6-small-group-worker-54qfm
```

0 comments on commit 6dfed46

Please sign in to comment.