AKS Storage Implementation

AKS Storage Options

Azure Kubernetes Service provides several storage options, each with its own characteristics and use cases.

AKS Built-in StorageClasses

When you create an AKS cluster, several StorageClasses are automatically created:

Storage ClassBacking Azure StorageDefaultReclaim PolicyVolume Binding Mode
managed-premiumPremium SSD Managed DisksYes (if node has premium storage)DeleteWaitForFirstConsumer
managed-csiStandard SSD Managed DisksYes (if node has standard storage)DeleteWaitForFirstConsumer
azurefile-csiAzure Files StandardNoDeleteImmediate
azurefile-premium-csiAzure Files PremiumNoDeleteImmediate

Azure Disk Storage

Azure Disk provides block storage for AKS. Key characteristics:

  • Performance: Premium SSD, Standard SSD, or Standard HDD
  • Access Mode: ReadWriteOnce (can only be mounted to a single node)
  • Use Cases: Databases, applications requiring fast storage with a single reader/writer

Example of using Azure Disk in a deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app
        image: myapp:1.0
        volumeMounts:
        - name: my-data
          mountPath: /data
      volumes:
      - name: my-data
        persistentVolumeClaim:
          claimName: my-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: managed-premium
  resources:
    requests:
      storage: 5Gi

Azure Files Storage

Azure Files provides fully managed file shares accessible via SMB and NFS protocols. Key characteristics:

  • Performance: Standard or Premium tiers
  • Access Mode: ReadWriteMany (can be mounted to multiple nodes)
  • Use Cases: Shared configuration, content management systems, shared development environments

Example of using Azure Files:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-shared-pvc
spec:
  accessModes:
  - ReadWriteMany
  storageClassName: azurefile-premium-csi
  resources:
    requests:
      storage: 100Gi

Custom Storage Classes

You can also create custom storage classes to meet specific requirements:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: managed-ultra
provisioner: disk.csi.azure.com
parameters:
  skuName: UltraSSD_LRS
  cachingMode: None
  diskIopsReadWrite: "2000"
  diskMbpsReadWrite: "320"
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true

Volume Binding Modes in AKS

AKS supports two volume binding modes:

  1. Immediate: Volume is provisioned as soon as the PVC is created
  2. WaitForFirstConsumer: Volume is provisioned only when a pod using the PVC is created

The second option is preferred in multi-zone clusters as it ensures the volume is created in the same zone as the pod, avoiding cross-zone data transfer penalties.

Storage Integrations

AKS integrates with other Azure services for enhanced storage capabilities:

  • Azure Backup Integration - AKS workloads can leverage Azure Backup for protecting persistent volumes using the Velero backup controller.
  • Azure NetApp Files - For high-performance file storage requirements, AKS can integrate with Azure NetApp Files, providing enterprise-grade file storage with ultra-low latency.
  • Azure Blob Storage - For object storage needs, pods can interact with Azure Blob Storage using the Blob CSI driver or SDKs.

Further Reading and Resources