AWS EKS Single POD multi tenancy architecture deployment with RDS

38 Views Asked by At

We wanted to achieve multi tenancy where we want to run single EKS POD in kubernetes that will connect to multiple RDS based on the URL.

We have made changes in our application that will access the database based on the http url. For example if I'll access https://walmart.com then our application will access the walmart RDS.

Our current structure is setup in a way where we run independent POD in EKS kubernetes for each client and separate RDS instance. We have setup jenkins pipeline and terraform script which register new DNS in Route53 and run a POD for each new client.

Current Architecture:

Current Architecture

We want to run single POD that will connect with each client's database based on the DNS being accessed in the URL. Then if we want to release a new feature then we will only have to update one POD deployment, then our all the clients will have the same app version.

Required architecture:

Required architecture

if any one knows how we can achieve this then that will help us.

Appreciated.

I have tried couple of articles but that is not enough. Those doesn't full fill the requirement.

1

There are 1 best solutions below

0
Guru On

It is achievable. But thing here is why? There are many down sides of this solution and few pro sides.

Answer:

  1. I am hoping you are using AWS load balancer. At loadbalancer level you have a setting to pre-serve the HOST header.
  2. Create multiple route53 entries to point to same ALB / Service
  3. In your application code you need to fetch HOST header and do your magic.

few thoughts:

  1. If one consumer face heavy load and app gets crashed. other cosumers also going to affect
  2. Consumers dont want to share there data (if it is critical)
  3. Why you not create multiple tables and use only one DB? May be this is cost effective solution.