-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathk3s.yml
349 lines (325 loc) · 7.45 KB
/
k3s.yml
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: dev.cruiser-secure-ingress
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(`dev.cruiser.dev`)
services:
- name: cruiser
port: 80
tls:
secretName: dev.cruiser.dev-tls
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pvc-cruiser-filestore
spec:
capacity:
storage: 16Gi
hostPath:
path: >-
/var/lib/rancher/k3s/storage/pvc-cruiser-filestore
type: DirectoryOrCreate
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Delete
storageClassName: local-path
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- k3s-02
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cruiser-filestore-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 4Gi
volumeName: pvc-cruiser-filestore
storageClassName: local-path
volumeMode: Filesystem
---
apiVersion: v1
kind: Service
metadata:
name: cruiser
spec:
selector:
app: cruiser
ports:
- protocol: "TCP"
port: 80
targetPort: 8080
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cruiser
spec:
selector:
matchLabels:
app: cruiser
replicas: 1
template:
metadata:
labels:
app: cruiser
spec:
volumes:
- name: filestore
persistentVolumeClaim:
claimName: cruiser-filestore-pvc
serviceAccountName: cruiser-server
containers:
- name: cruiser
image: harbor.dotglitch.dev/library/cruiser:latest
resources:
requests:
cpu: 10m
memory: 100Mi
limits:
cpu: 500m
memory: 1000Mi
ports:
- containerPort: 8080
env:
- name: SURREAL_URL
value: 'http://cruiser-db.cruiser-dev.svc.cluster.local:8000'
- name: CRUISER_AGENT_NAMESPACE
value: cruiser-dev
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://dynatrace-otel-collector.dynatrace-otel.svc.cluster.local:4318/v1/traces"
- name: CRUISER_ADMINISTRATOR
valueFrom:
configMapKeyRef:
name: cruiser-config
key: CRUISER_ADMINISTRATOR
- name: SURREAL_USER
valueFrom:
secretKeyRef:
name: cruiser-db-secret
key: SURREAL_USER
- name: SURREAL_PASSWORD
valueFrom:
secretKeyRef:
name: cruiser-db-secret
key: SURREAL_PASS
- name: SESSION_SECRET
valueFrom:
secretKeyRef:
name: cruiser-secret
key: SESSION_SECRET
- name: GITHUB_OAUTH_SECRET
valueFrom:
secretKeyRef:
name: cruiser-github-secret
key: GITHUB_OAUTH_SECRET
- name: GITHUB_OAUTH_CLIENTID
valueFrom:
secretKeyRef:
name: cruiser-github-secret
key: GITHUB_OAUTH_CLIENTID
- name: CRUISER_CLUSTER_URL
valueFrom:
configMapKeyRef:
name: cruiser-config
key: CRUISER_CLUSTER_URL
volumeMounts:
- name: filestore
mountPath: /filestore
securityContext:
privileged: false
allowPrivilegeEscalation: false
# readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 101
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /manifest.webmanifest
port: 8080
initialDelaySeconds: 60
failureThreshold: 3
periodSeconds: 10
imagePullSecrets:
- name: harbor-key
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: dev.cruiser.dev
spec:
commonName: dev.cruiser.dev
dnsNames:
- dev.cruiser.dev
issuerRef:
kind: ClusterIssuer
name: letsencrypt-prod
secretName: dev.cruiser.dev-tls
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pvc-cruiser-db
spec:
capacity:
storage: 16Gi
hostPath:
path: >-
/var/lib/rancher/k3s/storage/pvc-cruiser-db
type: DirectoryOrCreate
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Delete
storageClassName: local-path
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- k3s-03
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cruiser-db-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 16Gi
volumeName: pvc-cruiser-db
storageClassName: local-path
volumeMode: Filesystem
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cruiser-db
namespace: cruiser-dev
spec:
selector:
matchLabels:
app: cruiser-db
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: cruiser-db
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: cruiser-db-pvc
containers:
- name: cruiser-db
image: surrealdb/surrealdb:v1.5.4
ports:
- containerPort: 8000
resources:
requests:
cpu: 10m
memory: 100Mi
limits:
cpu: 500m
memory: 1000Mi
args: ["start", "file:/data/database.db"]
volumeMounts:
- name: data
mountPath: /data
securityContext:
privileged: false
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
# fsGroup: 1000
runAsUser: 1000
runAsGroup: 1000
capabilities:
drop:
- ALL
env:
- name: SURREAL_AUTH
value: 'true'
- name: SURREAL_CAPS_ALLOW_ALL
value: 'true'
- name: SURREAL_LOG
valueFrom:
configMapKeyRef:
name: cruiser-db-config
key: SURREAL_LOG
optional: true
- name: SURREAL_USER
valueFrom:
secretKeyRef:
name: cruiser-db-secret
key: SURREAL_USER
- name: SURREAL_PASS
valueFrom:
secretKeyRef:
name: cruiser-db-secret
key: SURREAL_PASS
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://dynatrace-otel-collector.dynatrace-otel.svc.cluster.local:4318/
- name: SURREAL_TRACING_TRACER
value: otlp
---
apiVersion: v1
kind: Service
metadata:
name: cruiser-db
spec:
selector:
app: cruiser-db
ports:
- protocol: "TCP"
port: 8000
targetPort: 8000
type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cruiser-server
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cruiser-server-job-scheduler
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cruiser-server-job-scheduler-binding
subjects:
- kind: ServiceAccount
name: cruiser-server
roleRef:
kind: Role
name: cruiser-server-job-scheduler
apiGroup: rbac.authorization.k8s.io