Skip to content

Commit 7df1927

Browse files
authored
docs: add cross-cluster & authentication docs (#336)
1 parent b035c43 commit 7df1927

5 files changed

Lines changed: 49 additions & 0 deletions

File tree

docs/api/kuberay.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
KubeRay integration components for running Ray on Kubernetes. Learn how to use it [here](../tutorial/kuberay.md).
44

5+
!!! tip "Authentication"
6+
For connecting to auth-protected Ray clusters, see [Authentication docs](../tutorial/auth.md). Client-mode resources support Ray's [token authentication](https://docs.ray.io/en/latest/ray-core/internals/token-authentication.html) via environment variables. Pipes clients (`PipesKubeRayJobClient`) additionally accept `headers`, `cookies`, and `verify` parameters for HTTP-level authentication.
7+
8+
!!! tip "Custom host resolution"
9+
Override [`BaseKubeRayResource.resolve_hostname`][dagster_ray.kuberay.resources.base.BaseKubeRayResource.resolve_hostname] to customize how the Ray head service address is constructed (e.g. `name.namespace.company.com` instead of the default in-cluster FQDN).
10+
511
---
612

713
## Client Mode Resources

docs/tutorial/auth.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Authentication
2+
3+
## Ray Token Authentication
4+
5+
Ray supports [token authentication](https://docs.ray.io/en/latest/ray-core/internals/token-authentication.html) (v2.52.0+) which protects both gRPC (used by `ray.init()`) and HTTP (used by job submission) endpoints.
6+
7+
The client process needs two environment variables to be set:
8+
9+
- `RAY_AUTH_MODE=token`
10+
- `RAY_AUTH_TOKEN=<token>` (or `RAY_AUTH_TOKEN_PATH`)
11+
12+
### Authenticating Against Proxies
13+
14+
Pipes clients such as [`PipesKubeRayJobClient`][dagster_ray.kuberay.PipesKubeRayJobClient] or [`PipesRayJobClient`][dagster_ray.core.pipes.PipesRayJobClient] communicate with the Ray dashboard over HTTP. They support `headers`, `cookies`, and `verify` parameters for authentication:
15+
16+
```python
17+
PipesKubeRayJobClient(
18+
headers={"Authorization": "Bearer <token>"},
19+
)
20+
```
21+
22+
!!! tip
23+
24+
These parameters can also be overridden per-invocation in the [`PipesKubeRayJobClient.run`][dagster_ray.kuberay.PipesKubeRayJobClient.run] method.
25+
26+
This is useful when submitting jobs across Kubernetes clusters, where the traffic may be flowing through a proxy requiring additional authentication.

docs/tutorial/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ Check out [External Ray Clusters tutorial](./external.md) if you want to run Ray
55

66
## Dagster + KubeRay
77
See [KubeRay tutorial](./kuberay.md) if you want to use KubeRay's `RayJob` and `RayCluster` managed from Dagster
8+
9+
## Authentication
10+
See [Authentication](./auth.md) for setting up Ray authentication with `dagster-ray`

docs/tutorial/kuberay.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,16 @@ definitions = dg.Definitions(
288288
1. :bulb: `dagster-pipes` has to be installed in the remote environment!
289289

290290
When materializing the asset, `PipesKubeRayJobClient` will submit the script as a `RayJob` custom resource, monitor its status, and stream back logs and Dagster metadata.
291+
292+
## Custom Host Resolution
293+
294+
By default, KubeRay resources resolve the Ray head address as an in-cluster FQDN (`<service>.<namespace>.svc.cluster.local`). Override the [`resolve_hostname`][dagster_ray.kuberay.resources.base.BaseKubeRayResource.resolve_hostname] method to customize this, for example when connecting across clusters or through a custom DNS:
295+
296+
```python
297+
from dagster_ray.kuberay import KubeRayInteractiveJob
298+
299+
300+
class MyKubeRayInteractiveJob(KubeRayInteractiveJob):
301+
def resolve_hostname(self, service_name: str, namespace: str) -> str:
302+
return f"{service_name}.{namespace}.company.com"
303+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ nav:
1010
- Overview: tutorial/index.md
1111
- External Ray Clusters: tutorial/external.md
1212
- KubeRay: tutorial/kuberay.md
13+
- Authentication: tutorial/auth.md
1314
- API Reference:
1415
- Overview: api.md
1516
- Core: api/core.md

0 commit comments

Comments
 (0)