Score:0

Persistent volume claims vs subPath

aw flag

I would like to use a single mount point on a node (ie /data) and have a different sub folder for each PersistentVolumeClaim that I am going to use in my cluster.

At the moment I have multiple StorageClass and PersistentVolume for each sub folder, for example:

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: prometheus
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: prometheus
  labels:
    type: local
spec:
  storageClassName: prometheus
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteOnce
  local:
    path: "/data/prometheus"
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: disk
              operator: In
              values:
                - local

As you can image having a StorageClass, a PersistentVolume for each PersistentVolumeClaim looks a bit of an overkill.

I have tried to use a single StorageClass and PersistentVolume (just pointing to /data), the usePath option (ie prometheus) with multiple PersistentVolumeClaim. But I have noticed that if the securityContext.fsGroupChangePolicy option is enabled it will apply the user/group changes to root of the volume (ie /data) not to the subPath (ie /data/prometheus).

Is there a better solution?

Thanks

Score:0
aw flag

local-path-provisioner seems to be a good solution

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.