简体   繁体   English

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

[英]kubernetes-helm: formating do-block-storage with xfs format

i am trying to create mongodb-replicaset with kubernetes-helm on digitalocean using do-block-storage. 我正在尝试使用do-block-storage在digitalocean上用kubernetes-helm创建mongodb-replicaset。 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. 由于mongodb建议使用xfs格式,因此我尝试使用如下配置使用xfs格式化do-block-storage,但似乎不起作用。 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: {}

There are two issues with your custom parameters (values.yaml): 自定义参数(values.yaml)有两个问题:

  1. MongoDB stable Helm chart does not know anything about user-defined field: "parameters". MongoDB稳定的Helm图表对用户定义的字段“ parameters”一无所知。 This is because it simply is not defined in any template file (mongodb/templates/*.yaml). 这是因为它根本没有在任何模板文件(mongodb / templates / *。yaml)中定义。 In your case Helm will render a similar file to this: 在您的情况下,Helm将渲染与此类似的文件:

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). 尽管曾经有人要求您在volumeClaimTemplates中指定“ fsType”(请参阅 github问题)。

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, eg create do-block-storage-xfs StorageClass liek this: 使用具有默认xfs文件系统格式的单独的StorageClass,然后在掌舵图的值中引用其名称,例如,创建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. 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 ) 预先创建在XFS的Fstype&PVC在K8S的DigitalOcean一个持久卷,并引用其作为头盔图表在现有的PVC(见persistence.existingClaim可配置参数在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM