How to name a dynamically create Persistent Volume?

Viewed 58

I am using azure-csi driver to dynamically create Persistent Volume and attach it to my Pod. I observed that the Presistent Volume which is created has dynamic names like pvc-12asdaxxxxx. Is there a way to assign a proper name (or prefix) for the Persistent Volume? My storage class config is :

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: azuredisk-premium-retain
provisioner: disk.csi.azure.com
parameters:
  kind: Managed
  storageaccounttype: Premium_LRS
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer

Below is how I am using the storage class to create Dynamic PV

spec:
  volumeClaimTemplates:
    - metadata:
        name: test
      spec:
        accessModes: "ReadWriteOnce"
        storageClassName: "azuredisk-premium-retain"
        resources:
          requests:
            cpu: 100m
            memory: 1Gi
0 Answers
Related