kubernetes-helm: formating do-block-storage with xfs format

2/21/2019

i am trying to create mongodb-replicaset with kubernetes-helm on digitalocean using do-block-storage. since mongodb recommended to use xfs format, i try to format do-block-storage with xfs using configuration like below, but it seem didn't work. can you help? thank you.

persistentVolume:
  enabled: true
  ## mongodb-replicaset data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: "do-block-storage"
  accessModes:
    - ReadWriteOnce
  size: 10Gi
  parameters:
    fsType: xfs
  annotations: {}
-- hbinduni
digital-ocean
kubernetes
kubernetes-helm
mongodb

1 Answer

2/22/2019

There are two issues with your custom parameters (values.yaml):

  1. MongoDB stable Helm chart does not know anything about user-defined field: "parameters". This is because it simply is not defined in any template file (mongodb/templates/*.yaml). In your case Helm will render a similar file to this:

volumeClaimTemplates: - metadata: name: datadir annotations: spec: accessModes: - "ReadWriteOnce" resources: requests: storage: "10Gi" storageClassName: "do-block-storage"

  1. You can't specify "fsType" in volumeClaimTemplates, although it was once requested (see this github issue).

I can see two possible workarounds for your issue:

  1. Use a separate StorageClass, with default xfs filesystem format, and then reference its name in helm chart`s values, e.g. create do-block-storage-xfs StorageClass liek this:

kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: do-block-storage-xfs namespace: kube-system annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: com.digitalocean.csi.dobs parameters: fstype: xfs

  1. Create in advance a Persistent Volume in DigitalOcean of xfs fsType & PVC in K8S, and reference it as an existing PVC in the Helm chart (see persistence.existingClaim configurable parameter here)
-- Nepomucen
Source: StackOverflow