Kubernetes StatefulSet

StatefulSet is a component from #202201291535 that define a blueprint and build up abstraction for stateful #202201311630 replication. It is usually used for database construction. For stateless pod see 202201311650.

Replications

Unlike in 202201311650, replicas in StatefulSet will have a static pod identity which is ordered numerically and will not change even after re-scheduling. Their ID are usually displayed as app-id and their domain name name will be displayed as app-id.service.

The first ever created replica will be the master, whereas the rest of them will be as workers. They will have their own storage to read into but only master has write access to its storage. All the replicas will continuously synchronise their state and data.

If there is a new replica created, it will copy state and data from the most recently created replica. After those are done, it will join the continuous synchronisation with other replicas.

If it is needed to delete replica, they will be deleted in order rather in random. Additionally, the deletion will be done in reverse order.

Note: Replicas cannot be created or deleted at the same time!

Note: If all the replicas dies, all the data could be lost! It is wise to have a 202202151901 so that the data stored does not tie to the lifetime of those pods.

Links to this page
#container