kind: Deployment
apiVersion: apps/v1
metadata:
  name: mongo
  labels:
    app: python-guestbook
    tier: db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: python-guestbook
      tier: db
  template:
    metadata:
      labels:
        app: python-guestbook
        tier: db
    spec:
      containers:
        - name: database
          image: mongo:4.1
          ports:
            - containerPort: 27017
          env:
          - name: MONGO_INITDB_ROOT_USERNAME
            valueFrom:
              secretKeyRef:
                name: mongo-secret
                key: username
          - name: MONGO_INITDB_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mongo-secret
                key: password