Hi. If anyone know solutions please help me how I can do this.
I have “statefulset” which has following “volumeClaimTemplates” inside:
When I scale my replica count
“kubectl scale statefulset --replicas=2 my-statefulset”
, new “PVC” create from “volumesnapshot” object which name = “MySnapshot”
volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data spec: accessModes: - ReadWriteOnce dataSource: apiGroup: snapshot.storage.k8s.io kind: VolumeSnapshot name: MySnapshot resources: requests: storage: 800Gi storageClassName: ebs-sc volumeMode: Filesystem
Is it possible to use dynamic name in field “volumeClaimTemplates.dataSource.name” ?
When new snapshot created modify statefulset and set volumeClaimTemplates.dataSource.name = new-name
Why I need this:
I have cronjob which automatically create snapshot with new name ex: MySnapshot_1, MySnapshot_2 …
And I need latest data into my “PVC” when new replica is created .