apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongo
  labels:
    package: core
spec:
  selector:
    matchLabels:
      app: mongo
  serviceName: mongo-service
  replicas: 3
  template:
    metadata:
      labels:
        app: mongo
        package: core
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: mongo
        image: mongo:4.2
        command:
          - mongod
          - "--bind_ip_all"
          - "--replSet"
          - mongo-set
        ports:
          - containerPort: 27017
        volumeMounts:
          - name: mongo-volume
            mountPath: /data/db
  volumeClaimTemplates:
    - metadata:
        name: mongo-volume
        labels:
          package: core
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 10Gi
