Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.19.6
I need to use Strapi application in Kubernetes cluster using docker images.
In my case there is a decision to use PostgreSQL as a database. Usually I set up K8 applications to use replicas since I want the applications to be reliable and with fault tolerance.
Since PostgreSQL is a stateful application I have set up a StatefulSet for PostgreSQL with 2 replicas. But then I have noticed that the data in application is not replicated between to PostgreSQL pods. So I had to decrease replicas to 1 for not messing up with the data in PostgreSQL database.
Currently it works but I don’t think it’s a good idea to have only one pod (even created with StatefulSet with PV/PVC) in production
Can you tell me what is a best approach here to have master/slave PostgreSQL cluster in K8 and how this can be set up correctly? I found some similar topics: Database on kubernetes and How to dynamically configure a container and I see that for this I will need to install either Zalando Postgres Operator or CrunchyData Postgres Operator
The thing here is that I’m not a K8 administrator and I do not think that I will be able to install it (I just can create deployments, services etc in my namespace). Can this master/slave PostgreSQL architecture be implemented somehow into K8 namespace? Or in my case I can only set up 1 replica for PostgreSQL pod and rely only on K8 cluster stablity?