Scaling StatefulSets
Let's see how to scale StatefulSets up and down.
We'll cover the following
Each time a StatefulSet is scaled up, a Pod and a PVC is created. However, when scaling a StatefulSet down, the Pod is terminated but the PVC is not. This means future scale up operations only need to create a new Pod, which is then connected to the surviving PVC. The StatefulSet controller includes all of the intelligence to track and manage these mappings between Pods and PVCs.
You currently have 3 StatefulSet Pod replicas and 3 PVCs. Edit the sts.yml
file and change the replica count from 3 down to 2 and save your change. When you’ve done that, run the following command to repost the YAML file to the cluster.
Get hands-on with 1200+ tech skills courses.