-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.yaml
More file actions
166 lines (161 loc) · 4.69 KB
/
Copy pathdashboard.yaml
File metadata and controls
166 lines (161 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# dashboard.yaml — Kubernetes manifests for Fluidstack GPU Dashboard
# Apply with: kubectl apply -f dashboard.yaml OR python deploy.py
---
# ─── Deployment: GPU Dashboard (backend + frontend) ─────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
name: fluidstack-gpu-dashboard
labels:
app: fluidstack-gpu-dashboard
hackathon: power-to-prefill
spec:
replicas: 1
selector:
matchLabels:
app: fluidstack-gpu-dashboard
template:
metadata:
labels:
app: fluidstack-gpu-dashboard
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8000"
prometheus.io/path: "/prometheus"
spec:
containers:
# ── FastAPI Backend ──
- name: backend
image: python:3.11-slim
command:
- sh
- -c
- |
pip install fastapi uvicorn requests prometheus_client &&
cd /app && python -m uvicorn app:app --host 0.0.0.0 --port 8000
ports:
- containerPort: 8000
name: api
env:
- name: FLUIDSTACK_API_KEY
valueFrom:
secretKeyRef:
name: fluidstack-credentials
key: api-key
optional: true
- name: NUM_MOCK_GPUS
value: "4"
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
nvidia.com/gpu: "0" # Set to 1+ when running on GPU nodes
volumeMounts:
- name: app-code
mountPath: /app
livenessProbe:
httpGet:
path: /
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 8000
initialDelaySeconds: 10
periodSeconds: 5
# ── Streamlit Frontend ──
- name: frontend
image: python:3.11-slim
command:
- sh
- -c
- |
pip install streamlit plotly requests pandas numpy &&
cd /app && streamlit run dashboard.py --server.port=8501 --server.headless=true --server.address=0.0.0.0
ports:
- containerPort: 8501
name: ui
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
volumeMounts:
- name: app-code
mountPath: /app
volumes:
- name: app-code
configMap:
name: fluidstack-dashboard-code
optional: true
# NOTE: In production, mount app code via a proper container image
# or use an initContainer to clone from git.
---
# ─── Service: NodePort for external access ──────────────────────────────────
apiVersion: v1
kind: Service
metadata:
name: fluidstack-gpu-dashboard-svc
labels:
app: fluidstack-gpu-dashboard
spec:
type: NodePort
selector:
app: fluidstack-gpu-dashboard
ports:
- name: api
port: 8000
targetPort: 8000
nodePort: 30800
- name: ui
port: 8501
targetPort: 8501
nodePort: 30851
---
# ─── NVIDIA Device Plugin DaemonSet ─────────────────────────────────────────
# Required for GPU scheduling on Fluidstack/bare-metal/cloud k8s nodes.
# On Fluidstack managed clusters, this is typically pre-installed.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nvidia-device-plugin
namespace: kube-system
labels:
app: nvidia-device-plugin
spec:
selector:
matchLabels:
app: nvidia-device-plugin
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: nvidia-device-plugin
spec:
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
priorityClassName: system-node-critical
containers:
- name: nvidia-device-plugin
image: nvcr.io/nvidia/k8s-device-plugin:v0.15.0
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: device-plugin
mountPath: /var/lib/kubelet/device-plugins
volumes:
- name: device-plugin
hostPath:
path: /var/lib/kubelet/device-plugins