Storage Concepts in Azure Kubernetes Service (AKS)
AKS provides a robust set of storage options that enable you to persist data for stateful applications running in containers. This guide covers the core concepts, best practices, and implementation details for using storage in AKS.
1. Persistent Volumes (PV) & Persistent Volume Claims (PVC)
A PersistentVolume represents a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using a StorageClass. A PersistentVolumeClaim is a request for storage by a user.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azurefile-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile
resources:
requests:
storage: 10Gi
2. Storage Classes
Storage classes define the type of underlying storage Azure provides. AKS includes several built‑in classes, and you can create custom classes for specific performance or replication requirements.
| Name | Provisioner | Features |
|---|---|---|
| default | kubernetes.io/azure-disk | Standard SSD, ZRS support |
| azurefile | kubernetes.io/azure-file | SMB, ReadWriteMany |
| managed-premium | disk.csi.azure.com | Premium SSD, high IOPS |
3. Container Storage Interface (CSI) Drivers
AKS uses CSI drivers to integrate Azure storage services natively. The most common drivers are:
- disk.csi.azure.com – Azure managed disks.
- file.csi.azure.com – Azure Files SMB shares.
- blob.csi.azure.com – Azure Blob storage as a mountable volume.
4. Data Protection & Backup
To protect stateful workloads, consider the following strategies:
- Enable Azure Disk snapshots for point‑in‑time recovery.
- Use Azure Backup for managed disks via the Azure portal or CLI.
- Leverage Velero for Kubernetes‑level backup and restore.
5. Best Practices
- Prefer
ReadWriteOncefor performance‑critical workloads. - Use
ReadWriteMany(Azure Files) only when multiple pods need concurrent access. - Tag your resources for cost tracking and lifecycle management.
- Configure pod anti‑affinity to distribute stateful pods across nodes for resilience.
For detailed step‑by‑step tutorials, visit the AKS tutorials section.