On this page
Azure Kubernetes Service (AKS) Storage
Introduction to Storage in AKS
Managing persistent storage for stateful applications in Kubernetes can be complex. Azure Kubernetes Service (AKS) integrates seamlessly with Azure's robust storage solutions to provide reliable and scalable persistent storage for your containerized workloads. This documentation outlines the various storage options available in AKS, how to provision and manage them, and best practices for optimal performance and reliability.
Understanding Kubernetes storage concepts like PersistentVolumes (PVs), PersistentVolumeClaims (PVCs), and StorageClasses is fundamental to effectively using storage in AKS.
Available Storage Options
AKS supports several Azure storage solutions, each offering different performance characteristics, features, and cost-effectiveness:
- Azure Disks: High-performance, block-level storage volumes for Linux and Windows virtual machines. Ideal for single-pod access.
- Azure Files: Fully managed cloud file shares accessible via the SMB and NFS protocols. Supports multiple concurrent pod access.
- Azure NetApp Files: Enterprise-grade, high-performance file storage for demanding workloads.
Kubernetes Persistent Storage Concepts
StorageClasses
A StorageClass provides a way for administrators to describe the "classes" of storage they offer. Different classes might map to quality-of-service levels, backup policies, or arbitrary policies determined by the cluster administrators. Kubernetes itself doesn't know what a particular class means, only the provisioner that is used to provision the storage.
In AKS, StorageClasses are used to dynamically provision Azure Disks and Azure Files.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: managed-csi-premium
provisioner: disk.csi.azure.com
parameters:
skuName: Premium_LRS
location: eastus
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
PersistentVolumeClaims
A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a pod consuming node resources. Pods request specific sizes and access modes (e.g., ReadWriteOnce, ReadOnlyMany, ReadWriteMany). A PVC is tied to the set of volumes that the matching StorageClass provides.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-csi-premium
resources:
requests:
storage: 10Gi
PersistentVolumes
A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using StorageClasses. It is a cluster resource. PVs have a lifecycle independent of any individual pod that uses the PV.
When you use dynamic provisioning with a StorageClass, AKS automatically creates PV objects to represent the provisioned Azure Disks or Azure Files.
Azure Disk Storage in AKS
Azure Disk Storage provides highly performant, durable block storage for your AKS workloads. It's suitable for applications requiring low latency and high throughput, such as databases or stateful applications.
Key Features:
- Performance Tiers: Standard HDD, Standard SSD, Premium SSD, and Ultra Disk provide options for various performance needs.
- Availability: Locally redundant storage (LRS) and zone-redundant storage (ZRS) are available.
- Access Modes: Typically
ReadWriteOnce(RWO), meaning the disk can be mounted as read-write by a single node.
Provisioning with StorageClasses:
AKS provides built-in StorageClasses for Azure Disks:
managed-premium: Uses Premium SSD managed disks with LRS.managed-standard: Uses Standard HDD managed disks with LRS.azurefile-csi-premium: For Azure Files Premium tier.azurefile-csi-standard: For Azure Files Standard tier.
You can also create custom StorageClasses to specify different SKUs, locations, and other parameters.
Azure Files Storage in AKS
Azure Files offers fully managed cloud file shares that can be accessed by multiple nodes and pods concurrently using the SMB or NFS protocols. This is ideal for shared configuration files, application data accessible by multiple instances, or migrating traditional file-share workloads.
Key Features:
- Protocol Support: SMB and NFSv4.1.
- Access Modes: Supports
ReadWriteMany(RWX) andReadOnlyMany(ROX), enabling concurrent access from multiple pods. - Performance Tiers: Standard and Premium file shares.
Provisioning with StorageClasses:
Use the built-in StorageClasses like azurefile-csi-premium or azurefile-csi-standard, or define your own.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-azurefile-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile-csi-premium
resources:
requests:
storage: 50Gi
Learn More about Azure Files Storage in AKS
Azure NetApp Files in AKS
Azure NetApp Files is an enterprise-grade file storage service built on NetApp technology. It provides extremely high performance, low latency, and advanced data management features, making it suitable for the most demanding workloads like SAP HANA, Oracle, and other mission-critical applications.
Key Features:
- High Performance: Offers very high IOPS and throughput.
- Advanced Features: Snapshots, replication, cloning.
- Protocols: SMB and NFS.
Integration with AKS requires setting up Azure NetApp Files and configuring custom StorageClasses.
Storage Best Practices in AKS
- Choose the Right Storage Type: Select Azure Disks for single-pod RWO access, Azure Files for multi-pod RWX access, and Azure NetApp Files for extreme performance needs.
- Dynamic Provisioning: Leverage
StorageClassesfor dynamic provisioning to automate storage management. - Reclaim Policy: Understand
reclaimPolicy(DeleteorRetain). UseDeletefor dynamic volumes managed byStorageClassesto automatically clean up underlying Azure resources when the PVC is deleted. UseRetainfor manually provisioned PVs where you want to keep the data. - Volume Expansion: Enable
allowVolumeExpansion: truein yourStorageClassesto allow resizing of PVs. - Performance Tuning: Monitor IOPS and throughput, and select appropriate Azure Disk SKUs (Premium SSD, Ultra Disk) or Azure Files tiers (Premium) for performance-sensitive applications.
- Backup and Disaster Recovery: Implement robust backup strategies for your persistent data using Azure Backup or other appropriate tools.
- Security: Secure your storage by configuring network security rules and access controls for your Azure storage accounts.