Repository navigation
Expand file tree
/
Copy pathmongo-db.yaml
More file actions
67 lines (66 loc) · 1.49 KB
/
Copy pathmongo-db.yaml
File metadata and controls
67 lines (66 loc) · 1.49 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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: stateful-mongo
spec:
serviceName: mongo-headless
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo:4.4-focal
ports:
- containerPort: 27017
name: mongodb
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: MONGO_INITDB_ROOT_USERNAME
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: MONGO_INITDB_ROOT_PASSWORD
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
- name: mongo-volume
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mongo-volume
configMap:
name: mongo-configmap
volumeClaimTemplates:
- metadata:
name: mongo-persistent-storage
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: mongo-headless
labels:
app: mongo
spec:
clusterIP: None
selector:
app: mongo
ports:
- name: mongodb
port: 27017
targetPort: 27017