-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongodb.yml
57 lines (55 loc) · 1.15 KB
/
mongodb.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
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb-statefulset
spec:
serviceName: mongodb-service
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- env:
- name: MONGO_INITDB_ROOT_USERNAME
value: mongoadmin
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: mongodb-password
name: restful-secrets
image: mongo
name: mongodb
ports:
- containerPort: 27017
resources:
limits:
cpu: 500m
memory: 128Mi
volumeMounts:
- mountPath: /data/db
name: data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"] # just one node can read/write at a time to this volume
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
clusterIP: None # headless service
ports:
- port: 27017
targetPort: 27017
selector:
app: mongodb