apiVersion: apps/v1 kind: StatefulSet metadata: name: mongodb spec: serviceName: mongodb replicas: 1 selector: matchLabels: app: mongodb template: metadata: labels: app: mongodb spec: containers: - name: mongodb image: mongo:latest ports: - containerPort: 27017 volumeMounts: - name: mongodb-data mountPath: /data/db - name: "init-database" mountPath: "/docker-entrypoint-initdb.d/" env: - name: MONGO_INITDB_DATABASE value: coopgo_platform volumes: - name: "init-database" configMap: name: create-db-configmap volumeClaimTemplates: - metadata: name: mongodb-data spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 1Gi