Enable Container Storage Interface (CSI) drivers for Azure disks and Azure Files on Azure Kubernetes Service (AKS)

The Container Storage Interface (CSI) is a standard for exposing arbitrary block and file storage systems to containerized workloads on Kubernetes. By adopting and using CSI, Azure Kubernetes Service (AKS) can write, deploy, and iterate plug-ins to expose new or improve existing storage systems in Kubernetes without having to touch the core Kubernetes code and wait for its release cycles.

The CSI storage driver support on AKS allows you to natively use:

  • Azure disks, which can be used to create a Kubernetes DataDisk resource. Disks can use Azure Premium Storage, backed by high-performance SSDs, or Azure Standard Storage, backed by regular HDDs or Standard SSDs. For most production and development workloads, use Premium Storage. Azure disks are mounted as ReadWriteOnce, so are only available to a single pod. For storage volumes that can be accessed by multiple pods simultaneously, use Azure Files.
  • Azure Files, which can be used to mount an SMB 3.0 share backed by an Azure Storage account to pods. With Azure Files, you can share data across multiple nodes and pods. Azure Files can use Azure Standard Storage backed by regular HDDs or Azure Premium Storage backed by high-performance SSDs.

Important

Starting in Kubernetes version 1.21, Kubernetes will use CSI drivers only and by default. These drivers are the future of storage support in Kubernetes.

Please remove manual installed open source Azure Disk and Azure File CSI drivers before upgrading to AKS 1.21.

In-tree drivers refers to the current storage drivers that are part of the core Kubernetes code versus the new CSI drivers, which are plug-ins.

Limitations

  • This feature can only be set at cluster creation time.
  • The minimum Kubernetes minor version that supports CSI drivers is v1.17.
  • The default storage class will be the managed-csi storage class.

Create a new cluster that can use CSI storage drivers

Create a new cluster that can use CSI storage drivers for Azure disks and Azure Files by using the following CLI commands. Use the --aks-custom-headers flag to set the EnableAzureDiskFileCSIDriver feature.

Create an Azure resource group:

# Create an Azure resource group
az group create --name myResourceGroup --location canadacentral

Create the AKS cluster with support for CSI storage drivers:

# Create an AKS-managed Azure AD cluster
az aks create -g MyResourceGroup -n MyManagedCluster --network-plugin azure  --aks-custom-headers EnableAzureDiskFileCSIDriver=true

If you want to create clusters in tree storage drivers instead of CSI storage drivers, you can do so by omitting the custom --aks-custom-headers parameter.

Check how many Azure disk-based volumes you can attach to this node by running:

$ kubectl get nodes
aks-nodepool1-25371499-vmss000000
aks-nodepool1-25371499-vmss000001
aks-nodepool1-25371499-vmss000002

$ echo $(kubectl get CSINode <NODE NAME> -o jsonpath="{.spec.drivers[1].allocatable.count}")
8

Next steps