Skip to content

Commit

Permalink
Add a demo for Using arena CLI in container.
Browse files Browse the repository at this point in the history
Signed-off-by: Syulin7 <735122171@qq.com>
  • Loading branch information
Syulin7 committed Jul 12, 2024
1 parent 5e8b6dd commit 057f472
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/cli/use-in-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:22.04

RUN apt update && apt install -y wget

RUN wget https://github.com/kubeflow/arena/releases/download/v0.9.15/arena-installer-0.9.15-f31e1b0-linux-amd64.tar.gz && \
tar -xvf arena-installer-0.9.15-f31e1b0-linux-amd64.tar.gz && \
cd arena-installer && \
bash install.sh --only-binary
16 changes: 16 additions & 0 deletions samples/cli/use-in-container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Use arena CLI in container

1. Build arena CLI image
```shell
docker build -t arena-demo:test -f Dockerfile .
```

2. Create rbac for arena
```shell
kubectl create -f rbac.yaml
```

3. Create arena CLI deployment
```shell
kubectl create -f deployment.yaml
```
28 changes: 28 additions & 0 deletions samples/cli/use-in-container/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: arena-demo
labels:
app: arena-demo
spec:
replicas: 1
selector:
matchLabels:
app: arena-demo
template:
metadata:
labels:
app: arena-demo
spec:
containers:
- name: arena-demo
image: arena-demo:test # replace it with your exactly <image_name:tags>
command:
- bash
- -c
- sleep infinity
resources:
requests:
cpu: 1
memory: 2Gi
serviceAccountName: arena-demo
155 changes: 155 additions & 0 deletions samples/cli/use-in-container/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: arena-demo
rules:
- apiGroups:
- ""
resources:
- pods
- nodes
- persistentvolumes
verbs:
- get
- list
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- list
- get
- apiGroups:
- ""
- apps
- extensions
resources:
- deployments
- replicasets
- statefulsets
- configmaps
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
- jobs
verbs:
- list
- get
- watch
- apiGroups:
- kubeflow.org
resources:
- tfjobs
- mpijobs
- pytorchjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- kai.alibabacloud.com
resources:
- trainingjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- sparkoperator.k8s.io
resources:
- sparkapplications
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch.volcano.sh
resources:
- jobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- scheduling.sigs.k8s.io
resources:
- elasticquotas
- elasticquotatrees
verbs:
- list
- watch
- get
- apiGroups:
- serving.kserve.io
resources:
- inferenceservices
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: arena-demo
name: arena-demo

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: arena-demo
name: arena-demo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: arena-demo
subjects:
- kind: ServiceAccount
name: arena-demo
namespace: default

0 comments on commit 057f472

Please sign in to comment.