Stateful Applications

Those applications that maintain some form of persistent state or data are called stateful applications. The key characteristic that differentiate them from stateless applications is that these applications don’t rely on storing data locally and they don’t treat each request as independent. They manage data between interactions. Sometimes stateless applications connect to the stateful application to forward the requests to a database.

Kubernetes StatefulSets: Running Stateful Applications in Containers

StatefulSets are Kubernetes components that are used specifically for deploying stateful applications. In Kubernetes on the basis on methods of deploying. There are two types of applications – Stateful applications and stateless applications. Therefore, There are two ways for deploying an application on Kubernetes – through Deployment (for deploying stateless applications) and through StatefulSets (for deploying stateful applications).

Applications that maintain any form of persistent state or data are called stateful applications. Most of the database applications that we build like MySQL and MongoDB are stateful applications. The basic point of difference between a stateful and a stateless application is the need of persistent storage. Stateful applications requires a persistent storage while stateless applications do not have a need to store data, therefore they don’t require any persistent storage.

Similar Reads

Stateful Applications And Stateless Applications

So what do we mean by stateful or stateless applications, basically all applications have some degree of state that is – in some applications the state of the application does not really impact the user (we will discuss this in stateless application section). These applications are called stateless applications. While other applications (like databases, message queues, caches, etc.) have a much higher degree of state because they rely on storage. This state does impact the user, that is we can not handle requests in a database independently. This type of applications are called Stateful applications. To explain these points further:...

Stateful Applications

Those applications that maintain some form of persistent state or data are called stateful applications. The key characteristic that differentiate them from stateless applications is that these applications don’t rely on storing data locally and they don’t treat each request as independent. They manage data between interactions. Sometimes stateless applications connect to the stateful application to forward the requests to a database....

Stateless Applications

Those applications that do not maintain any form of persistent state or data locally are called stateless applications. In stateless applications, each request or interaction is treated independently. These applications are designed to be highly scalable, easy to manage and fault-tolerant because unlike Stateful applications, they don’t have to track past interactions or requests....

StatefulSets

As we discussed earlier, StatefulSets are Kubernetes component that is used specifically for stateful applications. according to the official Kubernetes documentation – StatefulSets are API objects in Kubernetes that are used to manage stateful applications. StatefulSets represents the set of pods with unique, persistent identities, and elastic hostnames. It makes us assured about the ordering of scaling and deployments in case of stateful applications since during scaling pods in stateful applications, pods get created as well as deleted in a specific order (gets created one by one and last one is deleted first)....

Deploying A Stateful Application Using Kubernetes StatefulSets

In this section, we will learn how to deploy a stateful Redis cluster using Kubernetes. Following the tutorial step by step in order to deploy the stateful set:...

Differences Between Deployment and StatefulSet

StatefulSet Deployment StatefulSets are Kubernetes component that is used specifically for stateful applications. Deployment is used to deploy stateless applications. In StatefulSets, the pods get created as well as deleted in a specific order In Deployment, all pods are created parallelly. When we scale down StatefulSets, the last pod gets deleted When we scale down a deployment a random pod is picked up and deleted A sticky and predictable name is assigned to the pods A random name is assigned to the pods. Each pod uses its own persistent volume (like we saw in the tutorial.) All the pods use the same persistent volume...

Conclusion

In this article we discussed about Kubernetes StatefulSets. These are Kubernetes used to deploy stateful applications. We also discussed what are these stateful and stateless applications? Stateful applications are applications that maintain some form of persistent state or data. While stateless applications are those applications that do not maintain any form of persistent state or data locally. To learn more about how to deploy StatefulSet we have an article on “How to Use Kubernetes StatefulSets“. We hope that this article helped you gain a basic insight on what Kubernetes StatefulSets are and why are they used in deploying Stateful applications....

FAQs On Kubernetes StatefulSets

1. When are StatefulSets used?...