Skip to content

Commit 6077c27

Browse files
authored
add samples for RayCluster token auth (ray-project#4200)
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
1 parent dd5c76e commit 6077c27

File tree

2 files changed

+80
-103
lines changed

2 files changed

+80
-103
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: ray.io/v1
2+
kind: RayCluster
3+
metadata:
4+
name: ray-cluster-with-auth
5+
spec:
6+
headGroupSpec:
7+
rayStartParams: {}
8+
template:
9+
spec:
10+
containers:
11+
- name: ray-head
12+
image: rayproject/ray:nightly-py311-cpu
13+
env:
14+
- name: RAY_AUTH_MODE
15+
value: token
16+
# You can create the secret manually with the following command:
17+
# kubectl create secret generic ray-cluster-with-manual-auth --from-literal=auth_token='raycluster_secret' -n default
18+
# And then use the following valueFrom to reference the secret:
19+
- name: RAY_AUTH_TOKEN
20+
valueFrom:
21+
secretKeyRef:
22+
key: auth_token
23+
name: ray-cluster-with-auth # change this to match your Secret name
24+
resources:
25+
limits:
26+
memory: 8G
27+
requests:
28+
cpu: 4
29+
memory: 8G
30+
ports:
31+
- containerPort: 6379
32+
name: gcs-server
33+
- containerPort: 8265
34+
name: dashboard
35+
- containerPort: 10001
36+
name: client
37+
workerGroupSpecs:
38+
- replicas: 1
39+
minReplicas: 1
40+
maxReplicas: 5
41+
groupName: workergroup
42+
rayStartParams: {}
43+
template:
44+
spec:
45+
containers:
46+
- name: ray-worker
47+
image: rayproject/ray:nightly-py311-cpu
48+
env:
49+
- name: RAY_AUTH_MODE
50+
value: token
51+
- name: RAY_AUTH_TOKEN
52+
valueFrom:
53+
secretKeyRef:
54+
key: auth_token
55+
name: ray-cluster-with-auth # change this to match your Secret name
56+
resources:
57+
limits:
58+
memory: 8G
59+
requests:
60+
cpu: 4
61+
memory: 8G
Lines changed: 19 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,46 @@
1-
apiVersion: v1
2-
kind: ConfigMap
3-
metadata:
4-
name: kube-rbac-proxy
5-
data:
6-
config-file.yaml: |
7-
authorization:
8-
resourceAttributes:
9-
namespace: default
10-
apiVersion: v1
11-
apiGroup: ray.io
12-
resource: rayclusters
13-
name: ray-cluster-with-auth
14-
---
15-
apiVersion: v1
16-
kind: ServiceAccount
17-
metadata:
18-
name: kube-rbac-proxy
19-
---
20-
apiVersion: rbac.authorization.k8s.io/v1
21-
kind: ClusterRoleBinding
22-
metadata:
23-
name: kube-rbac-proxy
24-
roleRef:
25-
apiGroup: rbac.authorization.k8s.io
26-
kind: ClusterRole
27-
name: kube-rbac-proxy
28-
subjects:
29-
- kind: ServiceAccount
30-
name: kube-rbac-proxy
31-
namespace: default
32-
---
33-
apiVersion: rbac.authorization.k8s.io/v1
34-
kind: ClusterRole
35-
metadata:
36-
name: kube-rbac-proxy
37-
rules:
38-
- apiGroups: ["authentication.k8s.io"]
39-
resources:
40-
- tokenreviews
41-
verbs: ["create"]
42-
- apiGroups: ["authorization.k8s.io"]
43-
resources:
44-
- subjectaccessreviews
45-
verbs: ["create"]
46-
---
471
apiVersion: ray.io/v1
482
kind: RayCluster
493
metadata:
504
name: ray-cluster-with-auth
515
spec:
6+
enableInTreeAutoscaling: true
7+
authOptions:
8+
mode: token
9+
rayVersion: '2.52.0'
5210
headGroupSpec:
53-
rayStartParams:
54-
dashboard-host: '127.0.0.1'
55-
dashboard-port: '8443'
11+
rayStartParams: {}
5612
template:
57-
metadata:
5813
spec:
59-
serviceAccountName: kube-rbac-proxy
6014
containers:
6115
- name: ray-head
62-
image: rayproject/ray:2.46.0
16+
image: rayproject/ray:nightly-py311-cpu
17+
resources:
18+
limits:
19+
memory: 8G
20+
requests:
21+
cpu: 4
22+
memory: 8G
6323
ports:
6424
- containerPort: 6379
65-
name: gcs
25+
name: gcs-server
6626
- containerPort: 8265
6727
name: dashboard
6828
- containerPort: 10001
6929
name: client
70-
resources:
71-
limits:
72-
cpu: "2"
73-
memory: "4Gi"
74-
requests:
75-
cpu: "2"
76-
memory: "4Gi"
77-
readinessProbe:
78-
exec:
79-
command:
80-
- bash
81-
- -c
82-
- wget -T 2 -q -O- http://localhost:52365/api/local_raylet_healthz | grep success && wget -T 10 -q -O- http://localhost:8443/api/gcs_healthz | grep success
83-
failureThreshold: 10
84-
initialDelaySeconds: 10
85-
periodSeconds: 5
86-
successThreshold: 1
87-
timeoutSeconds: 2
88-
livenessProbe:
89-
exec:
90-
command:
91-
- bash
92-
- -c
93-
- wget -T 2 -q -O- http://localhost:52365/api/local_raylet_healthz | grep success && wget -T 10 -q -O- http://localhost:8443/api/gcs_healthz | grep success
94-
failureThreshold: 120
95-
initialDelaySeconds: 30
96-
periodSeconds: 5
97-
successThreshold: 1
98-
timeoutSeconds: 2
99-
- name: kube-rbac-proxy
100-
image: quay.io/brancz/kube-rbac-proxy:v0.18.1
101-
args:
102-
- "--insecure-listen-address=0.0.0.0:8265"
103-
- "--upstream=http://127.0.0.1:8443/"
104-
- "--config-file=/etc/kube-rbac-proxy/config-file.yaml"
105-
- "--logtostderr=true"
106-
volumeMounts:
107-
- name: config
108-
mountPath: /etc/kube-rbac-proxy
109-
volumes:
110-
- name: config
111-
configMap:
112-
name: kube-rbac-proxy
11330
workerGroupSpecs:
114-
- replicas: 2
31+
- replicas: 1
11532
minReplicas: 1
11633
maxReplicas: 5
117-
groupName: worker-group
34+
groupName: workergroup
11835
rayStartParams: {}
11936
template:
12037
spec:
12138
containers:
12239
- name: ray-worker
123-
image: rayproject/ray:2.46.0
40+
image: rayproject/ray:nightly-py311-cpu
12441
resources:
12542
limits:
126-
cpu: 1
127-
memory: "4Gi"
43+
memory: 8G
12844
requests:
129-
cpu: 1
130-
memory: "4Gi"
45+
cpu: 4
46+
memory: 8G

0 commit comments

Comments
 (0)