apiVersion: apps/v1
kind: StatefulSet
metadata:
        name: mongo
        namespace: dynpv
        labels:
          app: mongo
spec:
        selector:
          matchLabels:
            app: mongo
        serviceName: mongo
        replicas: 3
        template:
          metadata:
            labels:
              app: mongo
          spec:
            terminationGracePeriodSeconds: 10
            containers:
              - name: mongo
                image: mongo
                command:
                  - mongod
                  - "--bind_ip_all"
                  - "--replSet"
                  - rs0
                ports:
                  - containerPort: 27017
                volumeMounts:
                  - name: volume-mongo
                    mountPath: /data/db
# à la place du            nodeSelector:
# dico affinity             kubernetes.io/os: linux
            affinity:
              nodeAffinity:
                requiredDuringSchedulingIgnoredDuringExecution:
                  nodeSelectorTerms:
                  - matchExpressions:
                    - key: kubernetes.io/os
                      operator: In
                      values:
                      - linux
        volumeClaimTemplates:
          - metadata:
              name: volume-mongo
            spec:
              storageClassName: microk8s-hostpath
              accessModes:
                - ReadWriteOnce
              resources:
                requests:
                  storage: 90Mi
