apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mongodbx-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: managed-premium
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: mongodbx
spec:
  type: LoadBalancer
  ports:
    - port: 27017
      targetPort: 27017
  selector:
    app: mongodbx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongodbx
spec:
  selector:
    matchLabels:
      app: mongodbx
  serviceName: mongodbx
  replicas: 1
  template:
    metadata:
      labels:
        app: mongodbx
    spec:
      nodeSelector:
        "kubernetes.io/os": linux
        "pool_name": "mongodbx"
      imagePullSecrets:
        - name: acr-image-pull-secret
      volumes:
        - name: mongodbx-pv
          persistentVolumeClaim:
            claimName: mongodbx-pvc
      containers:
        - name: mongodbx
          image: mongo:7.0.11
          #image: kodakcloud.azurecr.io/mongodb@sha256:2cf49f6423b0ea10aa5f8a8709a67216386429316c6d24275bc368f43c2b6d1a
          args:
            - '--dbpath'
            - /data/db
          command:
            - mongod
            - '--bind_ip_all'
            - '--replSet'
            - rs0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 27017
              protocol: TCP
          volumeMounts:
            - name: mongodbx-pv
              mountPath: /data/db