-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongo_statefulsets.yaml
42 lines (42 loc) · 1.06 KB
/
mongo_statefulsets.yaml
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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb-standalone
spec:
serviceName: database
replicas: 1
selector:
matchLabels:
app: database
template:
metadata:
labels:
app: database
selector: mongodb-standalone
spec:
containers:
- name: mongodb-standalone
image: mongo:4.0.8
env:
- name: MONGO_INITDB_ROOT_USERNAME_FILE
value: /etc/k8-training/admin/MONGO_ROOT_USERNAME
- name: MONGO_INITDB_ROOT_PASSWORD_FILE
value: /etc/k8-training/admin/MONGO_ROOT_PASSWORD
volumeMounts:
- name: k8-training
mountPath: /etc/k8-training
readOnly: true
nodeSelector:
kubernetes.io/hostname: mongodb-node
volumes:
- name: k8-training
secret:
secretName: k8-training
items:
- key: MONGO_ROOT_USERNAME
path: admin/MONGO_ROOT_USERNAME
mode: 0444
- key: MONGO_ROOT_PASSWORD
path: admin/MONGO_ROOT_PASSWORD
mode: 0444
---