Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs][KubeRay] Add doc for kubectl plugin #47851

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
89 changes: 89 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,89 @@
(kubectl-plugin)=

# Use Kubectl Plugin (Alpha Feature)

Starting from KubeRay v1.2.2, we have introduced a `kubectl ray` plugin to simplify common workflows when deploying Ray on Kubernetes. The plugin is designed to help users who are not familiar with Kubernetes to run Ray on Kubernetes with ease.

## Installation

Please follow the instructions in the [KubeRay Kubectl Plugin](https://github.com/ray-project/kuberay/tree/master/kubectl-plugin) to install the plugin.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We bundle the plugin binary into the KubeRay release now right? can we just download the bianry from the release?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like:

curl -LO https://github.com/ray-project/kuberay/releases/download/v1.2.2/kubectl-ray_v1.2.2_linux_amd64
cp kubectl-ray_v1.2.2_linux_amd64 /usr/local/bin/kubectl-ray 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. Let me create a PR in kuberay repo because the README.md is bundled into the tar file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created: ray-project/kuberay#2449

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I think we can directly add this part into this page too:

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

Copy link
Member Author

@MortalHappiness MortalHappiness Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in f8a5a41


Currently, the recommended way to install the plugin is to download the binary from the [release page](https://github.com/ray-project/kuberay/releases) and add it to your PATH.

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

```shell
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

Here assume you have a Ray cluster running on Kubernetes. Please see {ref}`RayCluster Quickstart <kuberay-raycluster-quickstart>` if you don't have a Ray cluster running on Kubernetes.

### Get all Ray clusters

```shell
$ kubectl ray cluster get

NAME NAMESPACE DESIRED WORKERS AVAILABLE WORKERS CPUS GPUS TPUS MEMORY AGE
ray-cluster-kuberay default 1 2 0 0 3G 24s
```

### 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 log ray-cluster-kuberay

No output directory specified, creating dir under current directory using cluster name.
Downloading file ./ for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./old/ for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./gcs_server.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./gcs_server.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./events/ for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./events/event_GCS.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./events/event_AUTOSCALER.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./events/event_RAYLET.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./debug_state_gcs.txt for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./monitor.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./monitor.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./ray_client_server.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./ray_client_server.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./dashboard.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./dashboard.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./monitor.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./raylet.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./raylet.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./log_monitor.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./debug_state.txt for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./log_monitor.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./dashboard_agent.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./agent-424238335.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./agent-424238335.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./runtime_env_agent.out for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./runtime_env_agent.err for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./runtime_env_agent.log for Ray Head ray-cluster-kuberay-head-qkrv8
Downloading file ./nsight/ for Ray Head ray-cluster-kuberay-head-qkrv8
```