question

AnkitRathod-6794 avatar image
0 Votes"
AnkitRathod-6794 asked AnkitRathod-6794 edited

Creating Azure File Share (private endpoint) Mount Point on AKS pods

Hi team.,

I have created Private AKS cluster and want to add a mount point as PV - Azure File Share(with private endpoint) to pods in the AKS.

I'm seeing the error as

125546-pv-storage-privateendpoint.png


Document(https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv) does not help much with private endpoint option.


azure-storage-accountsazure-kubernetes-serviceazure-private-link
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IamCoder-6455 avatar image
0 Votes"
IamCoder-6455 answered IamCoder-6455 edited

@AnkitRathod-6794, if you want to mount Azure File Share with AKS POD, you don't need to create PV.

  • Create Azure File Share

  • Create the Secret for underlyimng storage account

kubectl create secret generic test-secret --namespace my-dev --from-literal=azurestorageaccountname=[name of storage account] --from-literal=azurestorageaccountkey=[storage account key]

  • Then define POD YAML like below,


apiVersion: apps/v1
kind: Deployment
metadata:
name: test-pod
namespace: my-dev
spec:
selector:
matchLabels:
app: test-pod
template:
metadata:
labels:
app: test-pod
spec:
containers:
- image: test-image
name: test-pod

       volumeMounts:
         - name: file-share
           mountPath: /app/files 
   volumes:
   - name: file-share
     azureFile:
       secretName: test-secret
       shareName: share-name
       readOnly: true



Please make sure secret name and file share name should be same. Do let me know this this works for you.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AnkitRathod-6794 avatar image
0 Votes"
AnkitRathod-6794 answered AnkitRathod-6794 edited

@IamCoder-6455,

Thanks for the response,

I want to also mount the single file share on multiple pods, also my Storage account is accessed using private link and aks is also private cluster, so in this scenario will the above solution work ?

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes, this is the beauty with File Share, you can access from multiple POD using same YAML configuration. I have exact same case, private cluster, storage account within VNET, etc. and all works like charm. With this approach you're free from PV, SC, PVC, etc.

0 Votes 0 ·

@IamCoder-6455

iI want to create Multiple Mount Points(from single file share name) on single pod, and if I create multiple mount points basis the above logic, my data is shared between both the mount points(when i checked from inside the pods).

which I dont want, can you suggest strategy for the same ?

Also my Storage Account is in RAGRS, and when I do a failover from one region to another region and once the failover is completed and now the Primary Region for the Stroage Account is Changed, my pods are mounted to Storage Account File Share but lost the files in the mount point. , i had to recreate the Pod in order to get back my files in the mount point ., please suggest an how to over come this issue ??

0 Votes 0 ·