Storage – PaaS Compute Options

When you run applications, you need to store and retrieve data. For certain applications, you don’t need the data to be persistent. However, in some other cases, you need to persist data and make sure that they are not deleted, even if the container is deleted. Storage is also needed to inject environmental variables and secrets into your pods. Figure 9.20 shows the high-level components that are part of AKS storage.

FIGURE 9.20 Storage components

Let’s take a deep dive into each of these concepts and understand it. The concepts are implemented in Kubernetes by declaring these in YAML files. Since writing YAML files is out of scope for this book, you will learn the concepts only.

Volumes

As mentioned earlier, applications need storage to store and retrieve data. Pods are ephemeral in nature, which means the data stored will be deleted when the pod is deleted. Volume refers to a method by which you can store, retrieve, and persist data across pods and application lifecycles. The storage for the pods can be manually assigned to the pods, or you can let Kubernetes automatically create them. In AKS, data volumes can be created using Azure Files or Azure Disks.

Azure Disks can be referenced in the YAML file as a DataDisk resource. Both Azure Standard storage (HDD) and Premium storage (SSD) is supported. Since there is premium storage with high-performance SSD, this is ideal for production workloads that demand high IOPS. Azure Disk is mounted as ReadWriteOnce, so it will be available to a single node. If you are planning to implement shared storage, then Azure Files is the right choice.

Azure Files uses SMB 3.0 and lets you mount the same storage to multiple nodes and pods. In Azure Files also you have support for Standard storage and Premium storage. These files can be accessed by multiple nodes and pods at the same time, making it ideal for shared storage scenarios.

Persistent Volumes

The volumes that are created as part of the pod are ephemeral, and storage follows the same lifecycle as the pod. You can use a persistent volume (PV) to store that data beyond the lifecycle of the pod. PVs are managed and created by the Kubernetes API.

Both Azure Files and Azure Disks can provide PVs. The choice depends on whether you want the storage to be shared or to be attached to a single node.

Cluster administrators can provision PVs statically, and you can let the Kubernetes APIs create it dynamically on demand. In other words, when a pod is scheduled and the storage requested is unavailable, Kubernetes will create a PV using Azure Files or Azure Disks and attach it to the pod. The type of storage is determined by the StorageClass parameter you add in the YAML file.

0 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms of Use | About | Privacy Policy | Cookies | Accessibility Help | Contact