More about Kubernetes Storage
783847742145867209279EKS vs GKE: Managed Kubernetes Giants Compared
783847742122456754332Kubernetes Persistent Volumes, Claims, Storage Classes, and More
783847742140754530785Azure Kubernetes Service Tutorial: Integrate AKS with ACI
783847742139065538238Kubernetes Workloads with Cloud Volumes ONTAP: Success Stories
783847742138129884279Container Management in the Cloud Age: New Insights from 451 Research
78384774217586437381Using Cloud Manager for Kubernetes Deployment
783847742136264445000Kubernetes Storage: An In-Depth Look
783847742135954789702Monolith vs. Microservices: How Do You Run Your Applications?
78384774217175531176How to Set Up MySQL Kubernetes Deployments
783847742123122539634Kubernetes Shared Storage: The Basics and a Quick Tutorial
783847742122445995032AWS ECS vs Kubernetes: An Unfair Comparison?
78384774217838477421Cloud File Sharing: Kubernetes NFS Provisioning
783847742123526560806AWS Kubernetes Cluster: Quick Setup with EC2 and EKS
783847742126207422598Azure Kubernetes Service: Configuring Persistent Volumes in AKS
783847742123770128530Kubernetes NFS: Two Quick Tutorials
783847742114230122542Kubernetes for Developers: A Deep Dive
78384774217464342254Docker Volume Tutorial - Using Trident to Provision Storage
78384774217128569432Kubernetes Volume Cloning with Cloud Volumes ONTAP
78384774217080265854Kubernetes Cloud Storage Efficiency
78384774216868508720Protection for Persistent Data Storage in Kubernetes
78384774216747101383Kubernetes: Dynamic Provisioning with Cloud Volumes ONTAP
78384774216645906492Managing Stateful Applications in Kubernetes
78384774216563850893Kubernetes: Provisioning Persistent Volumes
78384774216488720912An Introduction to Kubernetes
The NFS (Network File System) protocol is an integral part of cloud file sharing in enterprise IT environments. It’s this protocol that Linux-based devices rely on. Using NFS gives access to a wide range of users to share files and data concurrently. This is an important capability when using Kubernetes storage.
There’s a large number of use cases where NFS is used, including creating data lakes for building analytics solutions, database services, data archives, and more. NFS can be used with Kubernetes pods to manage persistent storage requirements and share data and files between containers and other pods. However, in enterprise-scale deployments, provisioning persistent NFS volumes that stateful applications need can be a challenge for admins to handle manually, and without costs getting out of control.
With Cloud Volumes ONTAP and Trident, Kubernetes NFS provisioning can be automatic and cost-efficient. In this post we’ll look at deploying Kubernetes with NFS volumes and give you some code examples on how to deploy persistent Kubernetes NFS volume storage using NetApp’s Trident and Cloud Volumes ONTAP.
File Sharing with Kubernetes NFS Volumes
Let’s first take a look at some of the reasons why you’d use shared storage in a Kubernetes cluster.
For starters, there’s an advantage to NFS over iSCSI because managing a large number of individual iSCSI storage allocations can add to administrative overhead. All those block-level persistent volume allocations can make storage management more difficult, especially when Kubernetes persistent volumes are statically allocated. When using block storage this way, your overall storage utilization may wind up being lower than planned, as persistent volumes are only used by a single pod, and that pod may never use up all of the storage that has been allocated for it. There’s another additional snag in that sharing data between pods can be difficult when using block-level persistent volumes.
Unless containers are deployed to the same pod, sharing data between containers can also be difficult. Deploying containers in this way, i.e. to the same pod, should only be done when it makes sense for the application, such as when the containers work together directly to fulfill some function. Putting containers into the same pod when they simply need to share data can lead to scalability problems as a pod will only be scheduled to a single node.
NFS solves these problems by allowing many hosts to mount the same file system at the same time, and for all those individual hosts to concurrently access the file system. Using NFS, storage volumes don’t need to be formatted according to an operating system file system, such as ext4—storage can simply be mounted and be put right to work. This makes it easier to attach storage to Kubernetes pods, reducing the administrative heavy lifting that usually comes with persistent storage. NFS storage volumes in Kubernetes can also be easily expanded without any client-side changes using Trident, which we’ll discuss in more detail in the next section.
Kubernetes NFS Provisioning with Trident
NetApp Trident is a storage provisioner for Kubernetes that allows users to take advantage of NetApp storage services, both on-premises and in the cloud. Trident is a fully-supported, open-source solution that allows native Kubernetes manifests to be used to provision persistent volumes via Cloud Volumes ONTAP.
As a Kubernetes NFS volume provisioner, the benefits of using Trident include mounting persistent volumes as Read/Write Many, the ability to resize NFS persistent volumes dynamically, and the ability to create separate Kubernetes storage classes for use with different mount parameters and other requirements.
Mounting Persistent Volumes as Read/Write Many
Persistent Volumes using NFS can be mounted as Read/Write Many, which allows multiple pods to mount the same volumes. Using native Kubernetes constructs means that storage can be allocated without the need for custom procedures or processes. Using the Read/Write Many access mode allows many persistent volumes claims to access the same persistent volume.
With block-level Kubernetes persistent volumes, Read/Write Once must be used, which means that there is a 1-to-1 relationship between persistent volume claims and persistent volumes.
If you’re looking to make a persistent volume claim (PVC), here’s how you would do that for a Kubernetes NFS volume:
Dynamically Resizing NFS Persistent Volumes
Kubernetes supports editing persistent volume claims to request more storage space. With this capability, persistent volumes can be expanded without needing to re-create the pod that uses the storage. In order for that to happen, the underlying storage provisioner must support resize. Trident provides users with NFS-based persistent volumes that can be dynamically resized with all the back-end changes taken care of. This makes Trident a major value add.
By extending the support for resizing persistent volumes to NFS, Trident is a major value add.
Block-level storage, such as Amazon EBS, needs to have the file system extended when the underlying storage is expanded. Kubernetes will take care of this, but it will also require that the pod using the storage to be restarted. That will cause downtime. With NFS, no file system expansion is required, and the pod can continue to work without interruption.
How to Create Separate Kubernetes Storage Classes
Storage classes allow users to control the type and configuration when provisioning volumes for use with Kubernetes. That extends to the dynamic Kubernetes NFS provisioning that Trident provides.
Separate storage classes can be created for different mount parameters and other requirements, for example using separate storage classes for NFSv3 and NFSv4.
Below is a storage class manifest for a Kubernetes NFS volume:
The allowVolumeExpansion attribute controls whether the resizing of persistent volumes created using this storage class is allowed or not.
The storage class can be used to control the storage pool, or NetApp aggregate used to provision persistent volumes, e.g. a storage class named gold may be used to configure high performance back-end storage, whereas one called bronze may be configured for capacity storage.
More Kubernetes Benefits with Cloud Volumes ONTAP
Along with the ability to automatically provision persistent NFS volume storage dynamically that can be resized as needed, Cloud Volumes ONTAP has even more benefits for Kubernetes deployments. As an enterprise data management platform for use in AWS, Google Cloud, or Azure, it extends beyond cloud-specific native Kubernetes management services. It also allows persistent volumes to be used with iSCSI and SMB in addition to NFS. This makes Kubernetes file storage more flexible in large-scale enterprise deployments.
Plus, persistent storage with Cloud Volumes ONTAP benefits from data protection with NetApp Snapshot™ copies, instant, zero-capacity test copies with FlexClone®, and the data mobility and DR benefits that come with SnapMirror® data replication. Kubernetes deployments can also be protected with high availability configurations that provide redundancy across regions, ensuring business continuity. And Cloud Volumes ONTAP’s storage efficiencies can drastically lower your overall costs for Kubernetes persistent storage.
Using NFS for shared storage can be an attractive option because it can be easier to manage and more flexible than other storage formats, such as iSCSI. NetApp Trident and Cloud Volumes ONTAP make it easier to deploy and manage NFS for Kubernetes clusters in the cloud.
Using Trident as your Kubernetes NFS volume provisioner gives you some additional benefits that you won’t get with other provisioners, such as the ability to dynamically resize NFS persistent volumes. Combining that with Cloud Volumes ONTAP’s powerful data storage solutions, such as storage efficiency, volume cloning, and data replication, makes for an enterprise solution for Kubernetes and NFS.