Storage is required by containers and pods for a variety of purposes, from caching data to building stateful applications, such as database services. Kubernetes storage uses persistent volumes to create a separation between the application developers that simply require storage for their pods and the lower level details of how that storage is provisioned.
This layer of abstraction allows the storage implementation to be controlled independently of requesting applications. That means that, for example, storage can be provisioned using local storage in a development cluster and with a more robust solution in production.
In this article, we will take a look at Kubernetes persistent volume provisioning in detail and show how dynamic provisioning with NetApp Trident and Cloud Volumes ONTAP creates a compelling solution for deploying and managing storage in a Kubernetes cluster.
What are persistent volumes? Persistent volumes provide storage resources to pods in the same way that nodes provide compute. Each persistent volume is created by a provisioner that uses a plugin to interface with different types of backend storage, with support for Amazon EBS, Google Persistent Disk, and Azure Disk Storage among many others. The lifetime of a persistent volume is determined by its reclaim policy, which controls the action the cluster will take when a pod releases its ownership of the storage.
kind: PersistentVolume
apiVersion: v1
metadata:
name: pv0003
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
path: "/mnt/data"
server: 172.17.0.2
This is how it works: Each pod uses a persistent volume claim to bind to storage from the cluster of a particular size, access mode, and volume mode. The claim can also use a selector to only match volumes with a specific set of labels. On receiving a claim, the cluster will search for an existing persistent volume with which to fulfil the request. Cluster administrators can pre-allocate persistent volumes for the cluster, known as static provisioning, however, this requires prior knowledge of storage requirements as a whole.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: thepub
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: bronze
There’s another way to do this too. Dynamic volume provisioning is an alternative model for managing storage provisioning in Kubernetes, and is used to automatically deploy persistent volumes based on the claims received by the cluster. The Kubernetes storage class specified by a persistent volume claim defines the provisioner to be used to create the new persistent volume. Kubernetes provides a number of its own internal Kubernetes provisioners that make use of the plugins mentioned above, however, external provisioners are also supported.
Cloud Volumes ONTAP brings the power of NetApp appliances to AWS storage and Azure storage through the use of the native compute and storage resources available in each cloud environment. Cloud Volumes ONTAP provides major advantages for storage management in the cloud, including:
NetApp Trident is a fully-supported, open-source storage provisioner for Kubernetes that uses Cloud Volumes ONTAP or on-premises NetApp ONTAP systems for its backend storage. This allows pods to automatically access the storage they require, while at the same time benefiting from the data management capabilities of Cloud Volumes ONTAP. For example, as well as provisioning new storage volumes, Trident can also integrate with storage cloning to create a clone of an existing volume in response to a persistent volume claim. This is ideal for supporting DevOps pipelines and building test clusters.
Kubernetes persistent volumes create a separation between containerized applications and the storage they use, which enables much greater flexibility when it comes to how that storage is provisioned. The Trident provisioner from NetApp leverages the effectiveness of the Cloud Volumes ONTAP data management platform from within Kubernetes, adding great value to your use of cloud storage.
Learn more about how Cloud Volumes ONTAP supports Kubernetes Persistent Volume provisioning and management requirements of containerized workloads, and how Cloud Volumes ONTAP helps to address the challenges of containerized applications in these Kubernetes Workloads with Cloud Volumes ONTAP Case Studies.