This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path9-mongo-statefulset.yml
104 lines (104 loc) · 2.68 KB
/
9-mongo-statefulset.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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
namespace: mongo-ns
spec:
replicas: 3
serviceName: mongo
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
namespace: mongo-ns
spec:
terminationGracePeriodSeconds: 5
initContainers:
- name: prepare
image: mongo
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
args:
- /home/mongodb/scripts/prepare.sh
volumeMounts:
- name: mongo-dir
mountPath: /home/mongodb
- name: mongo-security
mountPath: /home/mongodb/security
- name: mongo-script
mountPath: /home/mongodb/scripts
env:
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
containers:
- name: mongo
image: mongo
workingDir: /home/mongodb
volumeMounts:
- name: mongo-dir
mountPath: /home/mongodb
- name: mongo-config
mountPath: /home/mongodb/config
- name: mongo-setup
mountPath: /docker-entrypoint-initdb.d
- name: mongo-volume-claim
mountPath: /data/db
ports:
- containerPort: 27017
env:
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_REPLICAS
value: "3"
envFrom:
- configMapRef:
name: mongo-env
- secretRef:
name: mongo-secret
command:
- /bin/sh
- -c
args:
- |
docker-entrypoint.sh mongod \
--replSet rs0 \
--config /home/mongodb/config/mongo.conf
volumes:
- name: mongo-dir
emptyDir: {}
- name: mongo-security
configMap:
name: mongo-security
defaultMode: 256 #0400
- name: mongo-config
configMap:
name: mongo-config
defaultMode: 292 #0444
- name: mongo-setup
configMap:
name: mongo-setup
defaultMode: 365 #0555
- name: mongo-script
configMap:
name: mongo-script
defaultMode: 365 #0555
volumeClaimTemplates:
- metadata:
name: mongo-volume-claim
namespace: mongo-ns
spec:
resources:
requests:
storage: 100Mi
accessModes:
- ReadWriteOnce