statefulset 中是否可以有 2 个或更多 PVC?
Is it possible to have 2 or more PVC in a statefulset?
我有一个来自 mongo 的状态集,带有 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
只需在您的 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
是的,一个有状态集中可以有多个 PVC。
我有一个来自 mongo 的状态集,带有 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
只需在您的 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
是的,一个有状态集中可以有多个 PVC。