hamburger icon close icon
Kubernetes Storage

Managing Stateful Applications in Kubernetes

Stateful applications, such as database services and message brokers, record and manage the information generated within an enterprise platform. Though Kubernetes storage has always supported stateless applications—which are horizontally scalable due to the interchangeability of each pod—stateful applications require stronger guarantees for the storage they use.

With data protection, high availability, and flexible provisioning across the cluster all outside the scope of Kubernetes, what can you do to help ensure those things for your Kubernetes deployments?

In this article, we will look at the options for deploying stateful applications using Kubernetes and discuss the ways in which Cloud Volumes ONTAP and NetApp Trident make it easier to manage, scale, and protect the data storage those applications depend upon.

Read on below as we cover:

The Big Difference Between Stateful Vs. Stateless

Why the need for extra guarantees when it comes to stateful vs stateless? Whereas the storage used by stateless containerized applications can simply be re-initialized when a pod is rescheduled to different node in the cluster, stateful applications are recording business-critical information that must be preserved at all costs—that requires persistent storage with an independent lifetime.

In Kubernetes, persistent volumes fill that role, and can be created using a variety of storage provisioners. The actual back-end storage services each provisioner interfaces with is responsible for providing adequate data protection, such as backup/restore and high availability, and other data management features.

Stateful Applications in Kubernetes

Kubernetes deployment persistent volumes are used to create a layer of abstraction between pods and their provisioned storage, allowing each to be managed separately. Pods use a persistent volume claim as a request for storage that is matched to a persistent volume by the Kubernetes cluster.

Using a reclaim policy of “retain”, a persistent volume will not be deleted or cleared down after the persistent volume claim is released. Because of this, in the event of a failure or the rescheduling of the pod onto a different node, the relationship between pod and storage can be re-established. Take a look at this example use case of deploying MySQL with WordPress where persistent volumes were used in this way to deploy a database server.

The manual creation of persistent volumes ahead of time is known as static provisioning and requires much more administrative overhead than dynamic provisioning. In dynamic provisioning, the cluster can automatically deploy storage in response to the persistent volume claims it receives. Stateful applications can take advantage of dynamic provisioning by using stateful sets, which use a volume claim template to allocate storage and then permanently bind the resulting persistent volume to the requesting pod. This is more useful for building a cluster of stateful pods, such as for NoSQL database systems like Cassandra.

In both static and dynamic provisioning scenarios, stateful applications have a very real need for reliable storage that is resilient against failure, and data protection features, such as backup and restore. In and of itself, these facilities are not provided by Kubernetes, but are instead delegated to the provisioner used and the storage backend. Users have to find outside solutions, such as Trident and Cloud Volumes ONTAP.

Automating the Provisioning Process in Kubernetes with NetApp

Blog CTA Banners-Masterclass-V1-03 NetApp Trident is a dynamic storage provisioner for Kubernetes that fulfils persistent volume claims using storage managed by Cloud Volumes ONTAP as well as other on-prem NetApp storage systems. By using cloud-native compute and storage infrastructure services, Cloud Volumes ONTAP gives end users some very serious advantages when it comes to data protection and storage management.

Trident provisions new persistent container storage that benefit from all of NetApp’s data management capabilities. Using stateful sets simplifies the deployment of all stateful applications by automating much of the required provisioning and administrative activity. If a pod in a stateful set goes down, Kubernetes will automatically bind a new instantiation of the pod to the dynamically provisioned persistent volume it was previously using.

Cloud Volumes ONTAP is deployable on AWS, Google Cloud, or Azure and delivers:

Blog CTA Banners-Masterclass-V1-03

Cluster Management Is Easier Than Ever

Stateful applications in Kubernetes require persistent storage with an independent lifecycle from their pods. This can be achieved using persistent volumes directly, however, stateful sets and dynamic provisioning provide a solution that is easier to manage and scale up. Dynamically provisioning storage for stateful sets using Trident and Cloud Volumes ONTAP provides the data protection, high availability, and flexible storage management that is a must for reliably storing enterprise information.

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.

Try it for yourself and learn how to configure Cloud Volumes ONTAP as the backend system for managing persistent volumes in your Kubernetes cluster.

New call-to-action

Software Architect