apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-db
  namespace: demo-mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-db
  template:
    metadata:
      labels:
        app: mongo-db
    spec:
      containers:
      - name: mongo-db
        image: mongo
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 27017
        env:
          - name:  MONGO_INITDB_ROOT_USERNAME
            valueFrom:
              secretKeyRef:
                name:  mongodb-credentials
                key:  mongodb-root-username
          - name:  MONGO_INITDB_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name:  mongodb-credentials
                key:  mongodb-root-password
