Azure Kubernetes Services (AKS) is one of the most versatile platforms on Azure. It can be tailored to run just about any kind of workload that you can throw at it ranging from a simple website to big data that requires access to massively scalable compute. One of the options that is most tunable on AKS is storage. AKS supports most of the major storage types on Azure and all of them are relatively easy to use and don’t require you to manually create them before using them. You can use Azure Files, Azure Disks, or even Blob Storage in one way or another. Given the available options, it might not always be clear when you might want to use one or the other. The answer to this question depends on the nature of the application one has in mind, but here is some general guidance that can help drive that decision.
If there was a default way to do persistent storage on AKS, files would fit the bill. Azure Files allows users to set up shares on a storage account and then mounted into pods as part of the file system for that pod. Azure offers a couple of different tiers for files on Azure, so one can use the standard tier for most use cases and then upgrade to the premium tier for more demanding loads. The other advantage of Files is that files are billed on a consumption model, meaning you only pay for what you use. With disks, you pay for the full capacity of the disk whether you are using it or not.
While Files offers a great option for most use cases, it is not for everything because Files tends to add some additional latency to requests and may not be as performant as disks. But if these are acceptable for the given workload, then Files may be the go-to option for storage on Azure.
When to use: As a default option for most general-purpose persistent storage on AKS.
Cost: Depends on data volume, performance tier, and redundancy options, but usually very economical for small data loads and elastic enough for large data loads.
Performance: Moderate to high depending on the tier
A second, easy to use option for storage on Azure is disks. AKS provides the ability to create and attach disks to an AKS cluster through declarative syntax in Kubernetes manifest files without having to create the disks separately. AKS supports both dynamic disks and persistent disks, so both can be set up and maintained for the duration of the app’s life. AKS data disks are attached to a cluster in such a way that the mounted volumes can be accessed by one or multiple pods on the cluster.
Disks are usually the best option for workloads that have high IOP’s demands and need low latency access to data. A few such cases might be databases or building code, which requires access to many small files with many small reads and writes. Both premium and standard disks are supported.
The downside to disks is that disks have to be allocated at the specified capacity, so the cost incurred is for the entire disk even if the entire disk is not used.
When to use: For applications with demanding data workloads such as databases.
Cost: Costs is reflective of the capacity of the disk used and the tier of the disk. Because the disk has to be fully allocated, costs may be relatively higher than the amount of data that is actually stored on the disk.
Performance: High performance
Blob storage as persistent storage can obviously be accomplished by incorporating the Blob API’s into an application. However, Azure does provide the ability to use Blob Storage as mounted storage for Linux through a project called Blobfuse. Blobfuse works by creating a virtual file system on a Linux host. Whenever a file on that system is requested, the driver will retrieve it from Blob Storage and put it in a temporary folder so the operations can be completed, then it writes the changed file back to Blob Storage once the file handles on the file have been released.
The tradeoff for using this approach though is that access to files may be slow and highly latent, so the performance of Blob Storage as a file system is not going to meet some apps with high demands, nor will it work for applications that need a lot of random reads and writes to files as well. The advantage though is that Blob Storage can be much cheaper than file storage for the same relative amount of data.
When to use: For applications where slow access to data might not be an issue, such as FTP.
Cost: Low relative to Disks and Files for the same amount of storage.
Performance: Low, because it introduces complexities that make accessing files slower than disks and files.
Choosing between these storage options really hinges on performance for the application. If you are unsure, stick with Azure Files. All in all, the ability to choose different types and even classes of storage gives you just one more way to tune AKS for your application’s needs.