Question

How to specify filesystem for Persistent Volumes in k8s cluster?

Posted September 13, 2021 67 views
Block StorageKubernetes

I have a Kubernetes cluster with a deployment which uses automatically provisioned block storage. My question is:

How can I specify the filesystem for the Persistent Volume? I would like for the Persistent Volume to be created with XFS in my case (my service is a MongoDB which recommends XFS filesystem).

Here is the section from my manifest for the Claim and volume mount:

...
        volumeMounts:
          - name: mongo-raw-volume-claim
            mountPath: /data/db
  volumeClaimTemplates:
  - metadata:
      name: mongo-raw-volume-claim
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: do-block-storage
      resources:
        requests:
          storage: 100Gi

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

@BobbyKo In your K8s StorageClass manifest file, you’ll need to set the fsType as follows:

e.g.
example-storageclass.yml:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard-retain-xfs
provisioner: dobs.csi.digitalocean.com
parameters:
  fsType: xfs
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

For further information regarding this, I recommend taking a look at the following documentation here.

I wish that it helps and all the best.

Think different and code well,

-Conrad