Managing stateful applications
Deployment
resources are beneficial for stateless workloads, as it does not need to add any state considerations while updating ReplicaSet
resources, but it cannot work effectively with stateful workloads. To manage such workloads, you can use a StatefulSet
resource.
StatefulSet resource
StatefulSet is a resource that helps manage stateful applications. They are similar to Deployment resources, but unlike the Deployment resource, they also keep track of state and require volumes and Service
resources in order to operate. StatefulSet
resources maintain a sticky identity to each Pod
. This means that the volume mounted on one Pod
cannot be used by the other. In a StatefulSet
resource, Kubernetes orders Pods by numbering them instead of generating a random hash. Pods within a StatefulSet
resource are also rolled out in order and scaling also happens in order. If a particular Pod
goes down and is recreated, the same volume is mounted to the Pod
.
The...