apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongodb
  labels:
    app: mongodb
spec:
  
  replicas: 1
  
  selector:
    matchLabels:
      app: mongodb
  
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      containers:
      - name: mongodb
        image: mongo:latest
        envFrom:
          - secretRef:
              name: restaurant
        volumeMounts:
          - name: restaurant-data-volume
            mountPath: /data/db

  volumeClaimTemplates:
    - metadata:
        name: restaurant-data-volume

      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: standard
        resources:
          requests:
            storage: 250Mi

  serviceName: mongodb

    