The following is the Statefulset yaml.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb
spec:
serviceName: mongo
replicas: 3
selector:
matchLabels:
app: mongo
( skip )
volumeClaimTemplates:
- metadata:
name: data-volume
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
Due to the use of the volumeClaimTemplates
, the PVC name must be:
data-volume-mongodb-0
data-volume-mongodb-1
data-volume-mongodb-2
However, the action of creating PVCs is not within my control. The PVC naming format provided by the other party is as follows:
mongodb-0-pvc
mongodb-1-pvc
mongodb-2-pvc
Therefore, I need to follow their naming format while continuing to use the volumeClaimTemplates
.
How should I modify it?
Thanks for everyone's comments. The PVCs name can only end with the ordinal, so no changing is needed.