From 9566096cafb636f1a9bd475a2a3e475e799f31ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondrej=20Ladomirj=C3=A1k?= Date: Sun, 17 Apr 2022 17:26:19 +0000 Subject: [PATCH] Add 'z2/mongo-stateful-set.yaml' --- z2/mongo-stateful-set.yaml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 z2/mongo-stateful-set.yaml diff --git a/z2/mongo-stateful-set.yaml b/z2/mongo-stateful-set.yaml new file mode 100644 index 0000000..b9d31a6 --- /dev/null +++ b/z2/mongo-stateful-set.yaml @@ -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 \ No newline at end of file