Kubernetes is fast an industry standard, with up to 94% of companies deploying their services and applications on the container orchestration platform, according to a survey. One of the main reasons companies turn to Kubernetes is the standardization that enables advanced users to gain productivity gains of up to two times.
Standardizing on Kubernetes gives organizations the power to deploy any workload, anywhere. But there was a piece missing: the technology assumed that workloads were ephemeral, meaning only stateless workloads could be safely deployed on Kubernetes. However, the community recently changed the paradigm and introduced features like StatefulSets and Storage Classes that allow data to be used on Kubernetes.
Running stateful workloads on Kubernetes is possible, but still challenging. In this article I present ways to implement it and why it is worthwhile.
Do it little by little
Kubernetes is on its way to becoming as popular as Linux and the de facto way of running any application anywhere and distributed. Using Kubernetes requires learning many technical concepts and vocabulary. For example, newcomers might struggle with the many logical units of Kubernetes such as containers, pods, nodes, and clusters.
If you’re not already running Kubernetes in production, don’t jump straight into data workloads. Instead, start moving stateless apps to avoid data loss when things go sideways.
If you don’t find an operator that suits your needs, don’t worry because most of them are open source.
Understand the limitations and specifics
Once you’re familiar with general Kubernetes concepts, dive into the specifics for stateful concepts. For example, because applications can have different storage requirements such as performance or capacity requirements, you need to provide the right underlying storage system.
What the industry commonly calls storage profiles are referred to as storage classes in Kubernetes. They provide a way to describe the different types of classes that a Kubernetes cluster can access. Storage classes can have different quality of service levels, such as B. I/O operations per second per GiB, backup policies, or arbitrary policies like e.g. B. Binding modes and allowed topologies.
Another important component to understand is StatefulSet. It is the Kubernetes API object used to manage stateful applications and provides key features such as:
- Stable, unique network identifiers that you can use to track volume and detach and reattach them at will;
- Stable, persistent storage to keep your data safe;
- Orderly, frictionless deployment and scaling required for many Day 2 operations.
Although StatefulSet was a successful replacement for the infamous PetSet (now obsolete), it is still imperfect and has limitations. For example, the StatefulSet controller does not have built-in support for volume resizing (PVC) – which poses a major challenge when the size of your application data set is going to grow beyond the currently allocated storage capacity. There are workarounds, but such limitations need to be understood in a timely manner so that the engineering team knows how to deal with them.