kubernetes-helm:使用xfs格式格式化do-block-storage

问题描述 投票:0回答:1

我正在尝试使用do-block-storage在digitalocean上使用kubernetes-helm创建mongodb-replicaset。由于mongodb建议使用xfs格式,我尝试使用xfs格式使用xfs格式化do-block-storage,但它似乎不起作用。你能帮我吗?谢谢。

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: {}
mongodb kubernetes digital-ocean kubernetes-helm
1个回答
1
投票

您的自定义参数(values.yaml)存在两个问题:

  1. MongoDB稳定头盔图对用户定义的字段一无所知:“参数”。这是因为它没有在任何模板文件中定义(mongodb / templates / * .yaml)。在你的情况下,Helm将渲染一个类似的文件:

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

  1. 您不能在volumeClaimTemplates中指定“fsType”,尽管曾经请求过它(请参阅this github问题)。

我可以看到两个可能的解决方法:

  1. 使用具有默认xfs文件系统格式的单独StorageClass,然后在helm chart的值中引用其名称,例如创建do-block-storage-xfs StorageClass这个:

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. 在K8S中预先创建xfs fsType和PVC的DigitalOcean中的持久卷,并将其作为Helm图表中的现有PVC引用(请参阅persistence.existingClaim可配置参数here
© www.soinside.com 2019 - 2024. All rights reserved.