Skip to content

Commit d96987c

Browse files
committed
feat: runtime deployment
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 75d1345 commit d96987c

File tree

2 files changed

+197
-0
lines changed

2 files changed

+197
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
services:
2+
default:
3+
4+
# Provide GPU resource request for gpustack-runtime if not using default runtime.
5+
#
6+
# deploy:
7+
# resources:
8+
# reservations:
9+
# devices:
10+
# - driver: nvidia
11+
# capabilities: [gpu]
12+
13+
restart: always
14+
image: gpustack/runtime:main
15+
pull_policy: always
16+
tty: true
17+
command:
18+
- gpustack-runtime
19+
- --profile
20+
- --watch=60
21+
22+
# Provide privileged is used for detect devices.
23+
#
24+
privileged: true
25+
26+
# Specify name for enabling mirrored deployment,
27+
# must configure the same name in environment GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME.
28+
#
29+
container_name: gpustack-runtime
30+
environment:
31+
- GPUSTACK_RUNTIME_DEPLOY=Docker
32+
- GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true
33+
- GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=gpustack-runtime
34+
35+
# Mount necessary volume for gpustack-runtime to work properly.
36+
# - Mount docker socket for docker runtime.
37+
# - Mount gpustack data volume for persistent data storage.
38+
# - Mount other source if needed, please refer to pack/Dockerfile.
39+
#
40+
volumes:
41+
- gpustack-runtime-data:/var/lib/gpustack
42+
- /var/run/docker.sock:/var/run/docker.sock:ro
43+
# - /opt/...:/opt/...:ro
44+
volumes:
45+
gpustack-runtime-data: { }

deploy/manifests/kubernetes.yaml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: gpustack-system
6+
labels:
7+
"app.kubernetes.io/part-of": "gpustack"
8+
---
9+
apiVersion: rbac.authorization.k8s.io/v1
10+
kind: ClusterRole
11+
metadata:
12+
namespace: gpustack-system
13+
name: gpustack-runtime-deployer
14+
labels:
15+
"app.kubernetes.io/part-of": "gpustack"
16+
"app.kubernetes.io/component": "gpustack-runtime"
17+
rules:
18+
- apiGroups:
19+
- ""
20+
resources:
21+
- "pods"
22+
- "configmaps"
23+
- "services"
24+
- "pods/log"
25+
- "pods/exec"
26+
verbs:
27+
- "*"
28+
---
29+
apiVersion: rbac.authorization.k8s.io/v1
30+
kind: RoleBinding
31+
metadata:
32+
namespace: gpustack-system
33+
name: gpustack-runtime-deployer
34+
labels:
35+
"app.kubernetes.io/part-of": "gpustack"
36+
"app.kubernetes.io/component": "gpustack-runtime"
37+
subjects:
38+
- kind: ServiceAccount
39+
name: gpustack-runtime
40+
roleRef:
41+
apiGroup: rbac.authorization.k8s.io
42+
kind: ClusterRole
43+
name: gpustack-runtime-deployer
44+
---
45+
apiVersion: v1
46+
kind: ServiceAccount
47+
metadata:
48+
namespace: gpustack-system
49+
name: gpustack-runtime
50+
labels:
51+
"app.kubernetes.io/part-of": "gpustack"
52+
"app.kubernetes.io/component": "gpustack-runtime"
53+
---
54+
apiVersion: apps/v1
55+
kind: DaemonSet
56+
metadata:
57+
namespace: gpustack-system
58+
name: gpustack-runtime
59+
labels:
60+
"app.kubernetes.io/part-of": "gpustack"
61+
"app.kubernetes.io/component": "gpustack-runtime"
62+
"app.kubernetes.io/name": "gpustack-runtime"
63+
spec:
64+
selector:
65+
matchLabels:
66+
"app.kubernetes.io/part-of": "gpustack"
67+
"app.kubernetes.io/component": "gpustack-runtime"
68+
"app.kubernetes.io/name": "gpustack-runtime"
69+
updateStrategy:
70+
type: OnDelete
71+
template:
72+
metadata:
73+
labels:
74+
"app.kubernetes.io/part-of": "gpustack"
75+
"app.kubernetes.io/component": "gpustack-runtime"
76+
"app.kubernetes.io/name": "gpustack-runtime"
77+
spec:
78+
# Provide GPU resource request for gpustack-runtime if not using default runtime.
79+
#
80+
# runtimeClassName: nvidia
81+
82+
restartPolicy: Always
83+
containers:
84+
- name: default
85+
image: gpustack/runtime:main
86+
imagePullPolicy: Always
87+
tty: true
88+
command:
89+
- gpustack-runtime
90+
- --profile
91+
- --watch=60
92+
93+
# Provide privileged is used for detect devices.
94+
#
95+
securityContext:
96+
privileged: true
97+
98+
# Specify environment for enabling mirrored deployment,
99+
#
100+
env:
101+
- name: GPUSTACK_RUNTIME_DEPLOY
102+
value: "Kubernetes"
103+
- name: GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT
104+
value: "true"
105+
- name: GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME
106+
valueFrom:
107+
fieldRef:
108+
fieldPath: metadata.name
109+
- name: GPUSTACK_RUNTIME_KUBERNETES_NAMESPACE
110+
valueFrom:
111+
fieldRef:
112+
fieldPath: metadata.namespace
113+
- name: GPUSTACK_RUNTIME_KUBERNETES_NODE_NAME
114+
valueFrom:
115+
fieldRef:
116+
fieldPath: spec.nodeName
117+
118+
# Mount necessary volume for gpustack-runtime to work properly.
119+
# - Mount gpustack data volume for persistent data storage.
120+
# - Mount other source if needed, please refer to pack/Dockerfile.
121+
#
122+
volumeMounts:
123+
- name: gpustack-runtime-data
124+
mountPath: /var/lib/gpustack
125+
# - name: toolkit
126+
# mountPath: /opt/...
127+
volumes:
128+
- name: gpustack-runtime-data
129+
emptyDir: { }
130+
# - name: toolkit
131+
# hostPath:
132+
# name: /opt/...
133+
134+
# Inject service account to the Pod for accessing Kubernetes API.
135+
#
136+
serviceAccountName: gpustack-runtime
137+
138+
# It may be desirable to set a high priority class to ensure that a DaemonSet Pod
139+
# preempts running Pods.
140+
#
141+
# priorityClassName: important
142+
143+
# These tolerations are to have the DaemonSet runnable on control plane nodes
144+
# remove them if your control plane nodes should not run Pods.
145+
#
146+
tolerations:
147+
- key: node-role.kubernetes.io/control-plane
148+
operator: Exists
149+
effect: NoSchedule
150+
- key: node-role.kubernetes.io/master
151+
operator: Exists
152+
effect: NoSchedule

0 commit comments

Comments
 (0)