apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongodb
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: mongodb
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      containers:
        - image: mongo:4.2.0
          name: mongodb
          ports:
            - containerPort: 27017
              protocol: TCP
          resources:
            requests:
              memory: "64Mi"
              cpu: "252m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          volumeMounts:
            - mountPath: /data/db
              name: mongodata
      restartPolicy: Always
      volumes:
        - name: mongodata
          persistentVolumeClaim:
            claimName: mongo-pvc
