azure-aksazure-files

What is the path of the Persistent Volume with Azure File in AKS?


I followed this page to dynamically create an Azure file share for use by a pod in the Azure Kubernetes Service (AKS). The .yaml file is like this, the same as the example given on the page:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: my-azurefile
provisioner: file.csi.azure.com # replace with "kubernetes.io/azure-file" if aks version is less than 1.21
allowVolumeExpansion: true
mountOptions:
 - dir_mode=0777
 - file_mode=0777
 - uid=0
 - gid=0
 - mfsymlinks
 - cache=strict
 - actimeo=30
parameters:
  skuName: Premium_LRS

I believe the StorageClass is to replace the PersistentVolume. However, in PersistentVolume, we have to specify a hostpath which is the directory to store (and share) the files inside in a persistent manner, but there is no such setting in the above .yaml file. My pod which used the storage is a DB, so I think the data should be written to the persistent storage provided by Azure Files if the DB pod was configured and run properly. What is the path of the Azure files then?


Solution

  • lemme try helping uou here, In the abve YAML file, you've created a StorageClass for Azure Files using the CSI driver. and StorageClass is used to define how dynamic provisioning should occur, it doesn't specify the actual path where the data is stored on the Azure Files share. The path is made by the CSI driver based on the configurations.

    The specific path on the Azure Files share where your data is stored is managed by the Azure Files service itself. You won't see or define this path in your Kubernetes configuration.

    Within your application running inside the pod, you should configure it to read and write data to the mount path specified in your PVC. so that's the path where the Azure Files share is mounted inside the pod.

    for example, you've mounted the Azure Files share at /mnt/data in your pod, then your application should interact with data within the /mnt/data directory. guess its how you access it.