apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongodb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongodb
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      containers:
        - name: mongodb
          image: mongo
          env:
            - name: MONGO_INITDB_ROOT_USERNAME
              valueFrom:
                configMapKeyRef:
                  name: footprint-env
                  key: MONGO_INITDB_ROOT_USERNAME
            - name: MONGO_INITDB_ROOT_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: footprint-env
                  key: MONGO_INITDB_ROOT_PASSWORD
          volumeMounts:
            - mountPath: /data/db
              name: footprint-volume

      volumes:
        - name: footprint-volume
          persistentVolumeClaim:
            claimName: host-pvc
          # emptyDir: {} # It works but pod specific

