apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongodb-statefulset
  labels:
    app: mongodb
spec:
  serviceName: "mongodb-service"
  replicas: 1
  selector:
    matchLabels:
      app: mongodb

  template:
    metadata:
      name: mongodb-pod
      labels:
        app: mongodb
    spec:
      containers:
        - name: mongodb
          image: mongo:4.0.8
          ports:
            - containerPort: 27017
          envFrom:
            - secretRef:
                name: mongodb-secrets
          volumeMounts:
          - name: www
            mountPath: /data

  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
