apiVersion: v1
kind: PersistentVolume
metadata:
        name: pv-mongo-noeud1
spec:
        capacity:
          storage: 100Mi
        accessModes:
          - ReadWriteOnce
        persistentVolumeReclaimPolicy: Retain
        storageClassName: mongo-local-storage
        hostPath:
          path: /srv/data/mongo
          type: DirectoryOrCreate
        nodeAffinity:
          required:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - noeud1
---
apiVersion: v1
kind: PersistentVolume
metadata:
        name: pv-mongo-noeud2
spec:
        capacity:
          storage: 100Mi
        accessModes:
          - ReadWriteOnce
        persistentVolumeReclaimPolicy: Retain
        storageClassName: mongo-local-storage
        hostPath:
          path: /srv/data/mongo
          type: DirectoryOrCreate
        nodeAffinity:
          required:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - noeud2
---
apiVersion: v1
kind: PersistentVolume
metadata:
        name: pv-mongo-noeud3
spec:
        capacity:
          storage: 100Mi
        accessModes:
          - ReadWriteOnce
        persistentVolumeReclaimPolicy: Retain
        storageClassName: mongo-local-storage
        hostPath:
          path: /srv/data/mongo
          type: DirectoryOrCreate
        nodeAffinity:
          required:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - noeud3
