AKS - Persistent Data Storage
To mount an Azure Disk or Azure Files volume in a pod, developers must create a PersistentVolume (PV) and a PersistentVolumeClaim (PVC) object.
The PV object represents the actual storage resource, while the PVC object requests a specific amount of storage from the PV.
Developers can then use the PVC object to mount the storage in a pod using a VolumeMount.
StorageClass | PersistentVolume | PersistentVolumeClaim |
A StorageClass is an object that describes the storage requirements of a Kubernetes cluster. | ||
It provides a way to define different classes of storage with different performance characteristics and price points. | ||
When a user requests storage via a PVC, they can specify the StorageClass to use, and Kubernetes will dynamically provision a new PV that matches the StorageClass’s requirements. | A PersistentVolume is a piece of storage in a cluster that has been provisioned by an administrator or dynamically provisioned using a StorageClass. | |
This API object captures the details of the implementation of the storage, be that custom NFS server, or a cloud-provider-specific storage system. | A PersistentVolumeClaim is a request for storage by a user or a pod. | |
It is a way to consume a PV. | ||
A PVC can be bound to a PV that matches its requirements. | ||
A PVC can also trigger the dynamic provisioning of a PV if a storage class is specified. | ||
PVCs can also specify access modes like ReadWriteOnce, ReadOnlyMany, and ReadWriteMany. | ||
A PVC is a namespaced resource. |
What is the Reclaim Policy?
The reclaim Policy is a property that specifies how to manage the storage associated with a Persistent Volume (PV) when the associated Persistent Volume Claim (PVC) is destroyed.
In Kubernetes, a Persistent Volume is a piece of storage in the cluster, and a Persistent Volume Claim is a pod’s request for a certain quantity of storage.
Container Storage Interface (CSI) drivers
A CSI driver is a Container Storage Interface (CSI) driver plugin for Kubernetes to work with different storage systems. It is a standard for exposing arbitrary block and file storage systems to containerized workloads on Kubernetes.
Enabling blob drivers in AKS
Running the below command will create pods in kube-system which manages the driver.
az aks update
[ - enable-blob-driver]
[ - enable-disk-driver]
[ - enable-file-driver]
-n myAKSCluster -g myResourceGroup
The CSI storage driver support on AKS allows us to natively use the following:
Azure Disks | Azure Files | Azure Blob storage |
Disks can use Azure Premium Storage, backed by high-performance SSDs, or Azure Standard Storage, backed by regular HDDs or Standard SSDs. | ||
Use Premium Storage for PROD. | Azure Files is a fully managed file share service in Azure that allows you to store and access files from anywhere | Azure Blob storage can be used to mount Blob storage (or object storage) as a file system into a container or pod. |
Blob storage enables your cluster to support applications that work with large unstructured datasets like log file data, images or documents, and others. | With Azure Files, you can share data across multiple nodes and pods. Also, as soon as a pod writes its reflected in storage account with azure files. |
Azure files is suitable for multiple pod/node shared storage requirements | When the Azure Blob storage CSI driver is enabled on AKS, there are two built-in storage classes: azureblob-fuse-premium and azureblob-nfs-premium. |
| The data on the object storage can be accessed by applications using BlobFuse or Network File System (NFS) 3.0 protoco | | |
| Azure Disks are mounted as ReadWriteOnce and are only available to one node in AKS.
CANNOT be accessed by multiple pods simultaneously. | | |