AKS Persistent Storage – Azure Files Dynamic Provisioning

As you create and manage AKS clusters, you will soon enough understand that your application needs persistent storage to store application data. There are many different options available in AKS with Azure Native services. In this blog post we will be closing looking at using azure files as the persistent storage with the dynamic provisioning capabilities.

When you create a AKS cluster you will notice that you get a few storage classes already added to it.

Default Storage Classes

Azure files premium and azure files standard storage classes comes by default in the AKS clusters. You can leverage these storage classes to dynamically create persistent storage for your application. Let’s look at an example and see how the AKS cluster behaves at the backend.

The commands and the deployment information are in this github repo.

I assume that you have got a Kubernetes cluster already running. We will be creating a PVC with Azure files premium and a deployment with nginx to use it.

First use the dynamic_provisioning.yaml file to create the pvc and the deployment.

PVC and Deployment

Then remote into the pod that is running. Navigate to the mapped share and create a file as below.

Create new file

Scale the deployment to 5 instances as below.

Scale the instance to 5

Once all the pods are running, remote into a different pod and run the following commands.

Scale the instance to 5

Then go to the Azure Portal, browse to the azure files storage account, and check the content.

Scale the instance to 5

Scale the instance to 5

Scale the instance to 5

Scale the instance to 5

As you can see, the storage is available across multiple pods, and the pods are able to read write to the storage at the same time. The storage content is also available via the Azure Portal.