State in Kubernetes [closed] State in Kubernetes [closed] kubernetes kubernetes

State in Kubernetes [closed]


A Kubernetes can contain stateful services. Some examples are Redis cache or CockroachDB - but they should be a distributed service.

Ceph is a storage solution alternative.


In Kubernetes are objects called StatefulSets which are a workload APIs objects that maintains a sticky identity for each of the Pods to persistent volumes, so that you can reattach a volume to Pod that may be restarted on a different node. Such development is realy important to maintain state within a cluster, as an application like a database can now survive a Pod getting shut down. StatefulSets are mainly used with databases and clustered applications that have specific requirements. You can easy validate and modify them.

For example speaking abour scaling:With MySQL replication, you can scale your read query capacity by adding replicas. With StatefulSet, you can do this with a single command:

$ kubectl scale statefulset mysql  --replicas=5

Take a look: statefulset-database, Here you can find how to setup MySQL database using StatefulSet - mysql-statefulset.

Stateful applications are services that require backing storage and keeping state is critical to running the service. Databases such as MySQL, MongoDB, Postgres, and Cassandra are good examples. They need some form of persistent storage that will survive service restarts.

Speaking about Ceph. It is traditionally known for both object and block storage, but not for database storage. - read article: ceph-databases.

Take a look also on official documentation: statefulsets.