Add 'z2/mongo-stateful-set.yaml'
This commit is contained in:
parent
266d2eed24
commit
9566096caf
45
z2/mongo-stateful-set.yaml
Normal file
45
z2/mongo-stateful-set.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: mongodb
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mongodb
|
||||||
|
serviceName: mongo-service
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mongodb
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mongodb
|
||||||
|
image: mongo:latest
|
||||||
|
ports:
|
||||||
|
- name: mongodb
|
||||||
|
containerPort: 27017
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: MONGO_INITDB_ROOT_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mongo-secret
|
||||||
|
key: mongo-username
|
||||||
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mongo-secret
|
||||||
|
key: mongo-password
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /data/db
|
||||||
|
name: mongopvc
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: mongopvc
|
||||||
|
spec:
|
||||||
|
accessModes: ["ReadWriteMany"]
|
||||||
|
storageClassName: "local"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 500Mi
|
Loading…
Reference in New Issue
Block a user