0

我有一个来自 mongo 的 statefulset,有 2 个卷挂载:

          volumeMounts:
            - name: mongo-persistent-storage
              mountPath: /data/db
            - name: mongo-config-storage
              mountPath: /data/configdb

我想知道如何在 volumeClaimTemplates 中添加第二卷:

  volumeClaimTemplates:
  - metadata:
      name: mongo-persistent-storage
      annotations:
          volume.beta.kubernetes.io/storage-class: "sc-infra"
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 2Gi
4

2 回答 2

2

只需将附加声明附加到您的volumeClaimTemplates. 例子:

volumeClaimTemplates:
- metadata:
    name: mongo-persistent-storage
    annotations:
       volume.beta.kubernetes.io/storage-class: "sc-infra"
  spec:
    accessModes: [ "ReadWriteOnce" ]
    resources:
      requests:
        storage: 2Gi
- metadata:              # <-- append another claim
    name: mongo-config-storage
  spec:
    storageClassName: sc-infra
    accessModes: ["ReadWriteOnce"]
    resources:
      requests:
        storage: 1Gi
于 2022-01-19T01:47:32.667 回答
0

是的,一个状态集中可以有多个 PVC。

于 2022-01-19T06:18:36.760 回答