The benefits of scaling containers across a cluster in a Kubernetes deployment are clear. But if you’re running a stateful app, you need to find a way to provision persistent Kubernetes storage that won’t slow down your developers.
For most developers, that means dynamic storage provisioning. In this post we’ll show you how NetApp makes that easier than ever with Cloud Volumes ONTAP and Trident.
Jump down using the links below to learn more about:
Let’s start with what we do know: Kubernetes provides an extensible framework for managing data storage within a Kubernetes cluster. But if your application needs data to persist—such as in a database—your storage volumes need to be persistent.
Persistent volumes (PVs) provide the means for data storage to exist independently of pods and containers. Each pod specification may include a number of persistent volume claims (PVCs), which instruct the cluster to search for a suitable PV based on the requested size, access mode, labels, etc. This gives PVs the additional advantage of separating out the request for storage by application developers deploying a pod, from the low-level details of how Kubernetes administrators decide to make the storage available to the cluster.
So, how do you go about provisioning those PVs? At a high level, there are the two main options available for provisioning storage for Kubernetes workloads: either static or dynamic persistent volume (PV) allocation.
Static provisioning is basically an upfront purchase of storage that will be used to serve all your cluster’s needs. When using static allocation, administrators need to pre-allocate all PVs. This can be tricky, because to optimize costs and avoid additional allocations, you need precise foreknowledge of how the cluster’s storage resources will be used.
In some ways, that means you need to be able to predict the future. This makes it less ideal than the other provisioning method that is the main focus of this article: dynamic provisioning.
The other option is to use dynamic provisioning. In Kubernetes, dynamic provisioning means PVs are created more organically, giving your clusters an advantage when it comes to dealing with changing storage demands. Don’t know how much storage your pods are going to take up? Better go with dynamic provisioning. Most of the time in Kubernetes deployments, this will be the case. However, Kubernetes can't allocate those storage volumes for you on its own— that's where NetApp can help.
Using dynamic provisioning in a Kubernetes cluster adds a number of benefits:
Kubernetes comes with a variety of internal provisioners (in-tree plugins) that dynamically allocate storage using Amazon EBS, Google Persistent Disk, Azure Disk Storage, and other storage platforms. They can be used to provision storage for standalone Kubernetes clusters in the cloud or in managed clusters such as Azure Kubernetes Service (AKS), Amazon Elastic Container Service (Amazon ECS), or Google Kubernetes Engine (GKE).
Kubernetes does have in-tree plugin code that can allocate storage which is basically part of the core Kubernetes code. However, in-tree plugins posed a challenge in terms of supporting additional storage systems or upgrading existing systems because the plugin had to be dependent on Kubernetes release cycles. Container Storage Interface (CSI) strives to solve this problem.
CSI provides a standard for storage vendors to develop plugins that work with multiple container orchestration platforms including Kubernetes. CSI provides Kubernetes with a set of storage API primitives that can be used to perform storage operations, i.e., allocate, deallocate, attach, snapshot, clone, etc. However, it doesn't handle the storage layer itself.
This is where NetApp storage and Trident comes in.
NetApp Trident is a dynamic container storage interface (CSI) for use in Kubernetes. Trident automatically caters to persistent volume claims in Kubernetes by leveraging Azure disk storage, AWS EBS block storage, GCP Persistent Disks via Cloud Volumes ONTAP or on-premises ONTAP appliances.
This enables Kubernetes clusters to take advantage of the power of NetApp storage management for PV provisioning in on-premises, hybrid cloud, or multicloud environments without any oversight or additional effort from developers.
Below you can see an example of a Trident storage class definition that uses ONTAP as storage backend:
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
name: ontap-gold
provisioner: csi.trident.netapp.io
mountOptions:
- debug
parameters:
backendType: "ontap-nas"
media: "ssd"
provisioningType: "thin"
snapshots: "true"
Cloud Volumes ONTAP uses native cloud compute and storage services to create a virtual NetApp storage appliance in either AWS, Azure or GCP. This provides many features and benefits that just don’t exist when directly allocating storage, including:
For all the good that Kubernetes does, you still need to allocate storage for the workload you’re running on it. Kubernetes dynamic provisioning simplifies the deployment of persistent volumes within Kubernetes clusters, doing away with the need for administrators to manually allocate storage in advance. NetApp Trident enables PVs to be provisioned using Cloud Volumes ONTAP, which perfectly complements the container orchestration capabilities of Kubernetes with NetApp’s enterprise-grade storage solutions.