Let's perform the following steps to learn the storage class parameters required to construct an Azure Disk storage class that we can use to dynamically request new persistent volumes from AKS:
- AKS-based Kubernetes clusters are created with two locally redundant (LRS) storage classes by default. Let's list the storage classes on your AKS cluster:
$ kubectl get sc
NAME PROVISIONER AGE
default (default) kubernetes.io/azure-disk 13m
managed-premium kubernetes.io/azure-disk 13m
- Describe the default storage class:
$ kubectl describe sc default
Name: default
IsDefaultClass: Yes
...
Provisioner: kubernetes.io/azure-disk
Parameters: cachingmode=ReadOnly,kind=Managed,storageaccounttype=Standard_LRS
AllowVolumeExpansion: <unset>
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
- Create a zone-redundant storage class with the provisioner, kubernetes.io/azure-disk, and the Standard_ZRS skuName specified:
$ cat <<EOF | kubectl apply -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azure-zrs
provisioner: kubernetes.io/azure-disk
parameters:
storageaccounttype: Standard_ZRS
kind: Shared
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: Immediate
EOF
You can find the definition and use cases for different volume types on the Azure Disk volume types link in the See also section.
On Azure Cloud clusters, the default Azure Disk volume type is Standard_LRS. For database workloads, such as MongoDB, Cassandra, and PostgreSQL, Premium_LRS-type, high-performance SSDs are recommended.
- List the storage classes:
$ kubectl get sc
NAME PROVISIONER AGE
azure-zrs kubernetes.io/azure-disk 4s
default (default) kubernetes.io/azure-disk 18m
managed-premium kubernetes.io/azure-disk 18m
As you can see in our example, AKS clusters come with two predefined storage classes.