Specify Name of Fileshare with Dynamically Provisioned Storage

7/27/2020

Is it possible to specify the name (or post script to the automatically generated name) for azure fileshare storage that is dynamically provisioned with kubernetes. The automatically provisioned storage names look as follows:

kubernetes-dynamic-pvc-1254de92-8668-4245-bf78-2512fsgdges6

And I would like to change this to something like:

kubernetes-dynamic-pvc-1254de92-8668-4245-bf78-2512fsgdges6-username

either through specifying a new name (with generated UUID) or specifying a post script to the auto generated name.

The current deployment works by only specifying a PVC for the dynamically provisioned storage and the name can therefore not be specified in the PV file.

The yaml file for the storage-class contains the following:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: retain-fileshare-storage
provisioner: kubernetes.io/azure-file
parameters:
  skuName: Standard_LRS
allowVolumeExpansion: True
reclaimPolicy: Retain

The yaml file for the PVC contains the following:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: my-pvc
  labels:
    app: my-app
    chart: my-chart
    release: my-release
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
  storageClassName: retain-fileshare-storage

To clarify: I am not interested in the name of the PVC, but in the name of the actual resource (a fileshare in a storage account in this case) on Azure.

-- ejlouw
azure
azure-storage
kubernetes

0 Answers