concept stateful set in category openshift

appears as: stateful sets, stateful set, A stateful set, The stateful set
OpenShift in Action

This is an excerpt from Manning's book OpenShift in Action.

To solve this problem, OpenShift has a special object called a stateful set (known as a pet set in older versions of OpenShift). A stateful set is a powerful tool in the OpenShift users’ toolbox to facilitate many traditional workloads in a modern environment. A stateful set object is used in place of a replication controller as the underlying implementation to ensure replicas in a service, but it does so in a more controlled way.

Next, navigate to the stateful set in the OpenShift console by choosing Applications > Stateful Sets and selecting the mongodb stateful set object that was created. The details page for the stateful set object will open. Examine the two pods that the template created: as shown in figure 8.6, the bottom of the screen shows that the two pod names have an ordinal index associated with them. As mentioned earlier, that index also determines the startup and shutdown sequence.

Figure 8.6. Example mongodb stateful set in the console

From the command line, modify the stateful set to spin up a third replica:

$ oc scale statefulsets mongodb --replicas=3
statefulset "mongodb" scaled

Unlike previous use of the scale command, this time you need to explicitly state that you’re scaling a stateful set. In the OpenShift console, notice that the new pod that was created has a deterministic pod name with the ordinal index associated with it: mongodb-2.