Open Source Cloud and DevOps

Before discussing statefulsets, we discuss about stateful applications.

Nodejs application + MongoDB database MongoDb is the stateful application, and nodeJs is stateless.

Deployment difference in both types

Stateless applications are deployed using Deployment in the kubernetes. Stateful applications are deployed using Statefulsets.

Stateful applications in the statefulsets, each replica pod

If a pod dies, new pods is creatd with the same pod ID as before. This particularly helpful for certain kind of applications such as Databases. Databases generally have a architecture of master-slave to update the data in the disk. Only one pod is responsible to write the data and others are read only. Each pod has its own separate PV atached. Data is replicated among the Volumes. PV data is persisted even if one or pods dies simlutaneouly.