0

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!!

alex
  • 343
  • 2
  • 9

1 Answers1

3

Statefulsets and Operators are not that similar.

Statefulset is a Kubernetes resource that handles pods that you need to hold a state. Normally a pod would get a new name if it is killed and respawned by Kubernetes, but if it is managed by a Statefulset it respawns with the same name. You would often use Statefulset if you want your application to have some persistence.

Operators on the other hand are a pattern used in Kubernetes to extend the normal functionality by adding custom resource definitions (CRD) that are handled by a given operator.

I think you would use Statefulsets if you want to implement your own solution, and use an Operator if you want to use an existing one.

There exist multiple MongoDB Kubernetes Operators out there.but you could look into the MongoDB Community Kubernetes Operator

CrowDev
  • 71
  • 5
  • Thank you for your answer.. The problem i am facing with StatefulSets, is that se 2nd mysql database that is created is empty and is not the same as the 1st.. i would like the 2nd replica, to be exactly the same with the 1st... Maybe i am doing something wrong.. So what do you suggest?? @CrowDev – alex Sep 16 '21 at 13:12
  • I would not set up mysql databases manually and configure replication between them. Use a Kubernetes Operator to handle all the difficult setup around highly available SQL databases: [link](https://cloudblogs.microsoft.com/sqlserver/2018/12/10/availability-groups-on-kubernetes-in-sql-server-2019-preview/) – CrowDev Sep 27 '21 at 13:40