Assuming I wanted to implement the Database per Service pattern or one of its related patterns like Private-Tables-, Schema- or Database-server-per-service (https://microservices.io/patterns/data/database-per-service.html) for microservices: How do I go about this if I want to run the databases in Kubernetes and not with an external database or a managed database as a service?
Do I necessarily have to use StatefulSet
to deploy a database in Kubernetes, or is Deployment
sufficient in some cases? If so, in which?
Assuming that a set of microservices need the ability to store, e.g., relational data in a relational database:
If I wanted to implement Database-server-per-service, should every Deployment
of a microservice have its own StatefulSet
for its database?
Or should I deploy one StatefulSet
for all Deployment
s of any microservice and make a logical separation by creating a database per microservice in that one StatefulSet
?