Can someone please let me know what are the steps that needs to be followed to mount an Azure fileshare that has files in it, and will need to mount it on a pod in Kubernetes.
As I see in the documentation, Azure using SMB protocol for access a data:
Azure Files can be mounted either via SMB 2.1 and SMB 3.0. For connections coming from clients on-premises or in other Azure regions, Azure Files will reject SMB 2.1 (or SMB 3.0 without encryption). If secure transfer required is enabled for a storage account, Azure Files will only allow connections using SMB 3.0 with encryption.
Kubernetes do not support SMB directly, but has support of special type of volumes - AzureFile
, which will provide a SMB configuration automatically for you.
Next, for mount a storage, you need to:
Install packages to your nodes: yum -y install cifs-utils
. If you using Debian-like distribs like Ubuntu, check how to install that packages in your OS (probably, they have same names).
No, you need to:
Obtain an Microsoft Azure storage account and create a secret that contains the base64 encoded Azure Storage account name and key. In the secret file, base64-encode Azure Storage account name and pair it with name azurestorageaccountname, and base64-encode Azure Storage access key and pair it with name azurestorageaccountkey.
After that, you can create a Kubernetes secret with that file:
apiVersion: v1 kind: Secret metadata: name: azure-secret type: Opaque data: azurestorageaccountname: azhzdGVzdA== azurestorageaccountkey: eElGMXpKYm5ub2pGTE1Ta0JwNTBteDAyckhzTUsyc2pVN21GdDRMMTNob0I3ZHJBYUo4akQ2K0E0NDNqSm9nVjd5MkZVT2hRQ1dQbU02WWFOSHk3cWc9PQ==
apiVersion: v1 kind: Pod metadata: name: azure spec: containers: - image: kubernetes/pause name: azure volumeMounts: - name: azure mountPath: /mnt/azure volumes: - name: azure azureFile: secretName: azure-secret shareName: k8stest readOnly: false