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

  • 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