apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongodb-statefulset
  namespace: local-demo-ha-ns
spec:
  replicas: 1
  selector:
    matchLabels:
      sunlife.com/app: mongodb-pod
  serviceName: mongodb-service-headless
  template:
    metadata:
      labels:
        sunlife.com/app: mongodb-pod
    spec:
      containers:
      - name: mongodb-container
        image: mongo:latest
        ports:
        - containerPort: 27017
          name: mongodb-port
          protocol: TCP
        volumeMounts:
        - mountPath: /data/db
          name: mongodb-pvc
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: mongodb-pvc
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 1Gi
      storageClassName: local-storage
      volumeMode: Filesystem