Creating PersistentVolumes to cover many nodes with many disks

2/13/2020

I'm deploying a large Kube cluster where each node has 80 SSDs. Each disk is mounted as /data/diskN (disk0 - disk79) on each node.

Example PV:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: vol0022
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 100Gi
  local:
    path: /data/disk22
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: "storage"
          operator: In
          values:
          - "true"
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem

Do I merely create enough PV's to cover (num_nodes * num_disk_per_node)?

ie:

If I have 10 nodes, I'll have 10 PV's where the path is "/data/disk0", another 10 where the path is "/data/disk1", and so on.

Thx

-- Crashk1d
kubernetes
persistent-volumes

1 Answer

2/14/2020

Yes. If you try to create Persistent Volume for each of them.

A better way is to use a "StorageClass" (more information) like "Glusterfs" which will create a cluster for all the disk. Then you can directly create a PersistentVolumeClaim to claim some space without creating a PersistentVolume.

-- anmol agrawal
Source: StackOverflow