kubernetesoperatorsscalehpastatefulset

StatefulSets or Operators for scaling up mysql database on Kubernetes


I would like to scale up my mysql and mongo database with hpa !

I wonder if i should use Statefulsets, Operators or both.

Also i can't understand the difference between StatefulSets and Operators.

Could someone help me?

Thank you very much!!


Solution

  • Say you have 5 replicas deployed as stateful set and storage attached with the Persistent Volume Claims (PVC). The problem starts when you want to scale down or up. If you delete 2 replicas what happens to those volumes and the data?

    Before removing them you'd need to migrate the data, not to lose it. Another example is disaster recovery. For each technology like postgres, mysql, redis, elasticsearch etc these operations would differ, and manual intervention from a human would be required. The operator in the kubernetes is to replace that human operator with automation. So for each technology or specific use case, you can have operators that would handle these operations, as postgres operator, redis operator, etc.

    You can take a look at the community operators: https://operatorhub.io/

    Also the following articles to understand difference between stateful set ad operator:

    https://developer.redis.com/operate/orchestration/kubernetes-operator/

    https://vmblog.com/archive/2020/10/29/going-beyond-statefulsets-with-kubernetes-operators.aspx