We are trying to choose schema for allocation microservices in multi tenant application. We want to use kubernates and see two cases:
First case:
+ Looks like a more productive scheme
+ Easy to administer
- Difficult to implement
Second case:
+ More incapsulated
- Looks like a less productive scheme
Use the second case with a separate namespace per tenant.
Different configurations
You have designed a solution with a separate database for each tenant. You can run the same container image for the tenants but the should use different configurations e.g. they have different address to the database. See Twelve factor - externalize configuration.
We must always create a new service's container for each tenant. Although if load is low we could use one general container for all tenants
You can easily create the same service for each tenant using Kubernetes declarative Deployment manifests. You can also assign only the resources that is needed for each tenant, e.g. variations in number of replicas or different CPU or Memory resources.
Route error information to a central service
We have single entry point for detect errors
You should always route observability information, e.g. logs, metrics and events to a central service for your cluster.
Isolate tenants
In addition, if you have separate namespaces for tenants, you can isolate them more using Network Policies