Yash Panchal
← Back to Blog

Stateful sets

Key thing to understand.

Deployments are useful for stateless applications.

Statefulsets are used for stateful applications.

In statefulsets the replica pods are not identical, so they cannot be randomly terminated/interchanged.

So each of the pod has special identifiers for stickiness.

Now data persistance is one of the things that this offers. Similar to volume mounts there is volumemounttemplate that helps in scaling the volumes mounted to the pods based on the no of pods.

Essentially each pod is mounted to a volume and has its own data stored to the attached volume.

The pods in the stateful sets are created one by one instead of all of them being created immediately as in deployment.

Use case: database

video_to_the_point: https://www.youtube.com/watch?v=aRE_VmwCC4E&ab_channel=AntonPutra

video_reference: https://www.youtube.com/watch?v=pPQKAR1pA9U&ab_channel=TechWorldwithNana

Built with inspiration from astro-theme-cactus