Search code examples
azurekubernetesazure-aksazure-file-share

How to: Mount an Azure Storage File Share to On-premise cluster


I have been using AKS service and Azure file share but I want to test some applications on-premise and I want to mount my file share on an on-premise cluster

I want to create secrets and they should be running

In AKS I have been creating secrets and it is working as expected


Solution

  • There are ways to achieve this.

    1. You will need to have the Azure File share created in Azure obviously.
    2. Install cifs-utils
    3. To securely provide the Azure Files share username and access key to your on-premises server, create a credentials file that is only readable by yourself (root?)
    4. Mount the file share to your on-premises "server": sudo mount -t cifs //<STORAGE_ACCOUNT_NAME>.file.core.windows.net/<SHARE_NAME> <MOUNT_POINT> -o credentials=/etc/smbcredentials/<SHARE_NAME>.cred,serverino,vers=3.0,dir_mode=0777,file_mode=0777 -adjust the permissions after needs.
    5. Verify the mount points is available by either ls <MOUNT_POINT> or df -h
    6. Optionally add the mount point to /etc/fstab so that the share is available after a reboot.