apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongoexpress
  labels:
    dpl: mongoexpress
  namespace: mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      pod: mongoexpress
  template:
    metadata:
      labels:
        pod: mongoexpress
    spec:
      containers:
        - name: mongoexpress
          image: mongo-express
          ports:
            - containerPort: 8081
          env:
            - name: ME_CONFIG_MONGODB_SERVER
              valueFrom:
                configMapKeyRef:
                  name: mongodb-configmap 
                  key: mongodb-server
            - name: ME_CONFIG_MONGODB_ADMINUSERNAME
              valueFrom:
                secretKeyRef:
                  name: mongodb-secret
                  key: root_user
            - name: ME_CONFIG_MONGODB_ADMINPASSWORD
              valueFrom:
                secretKeyRef:
                  name: mongodb-secret
                  key: root_pass
