简体   繁体   中英

Route traffic based on HTTP headers

I am designing a scalable micro-service architecture using Kube.netes. The current setup looks like this:

Client --> Route53 --> ALB(Ingress) --> Application (Running inside EKS cluster)

This works fairly well with one Application Load Balancer(ALB). Now I want to scale this architecture by creating multiple EKS clusters in the same/different regions. The architecture diagram I am trying to achieve looks like this:

                        ________ ALB 1(Ingress) --> Application (Running inside EKS cluster 1)
                       |
Client --> Route53 ----|
                       |________ ALB 2(Ingress) --> Application (Running inside EKS cluster 1)

There can be n number of such ALBs available. I want to redirect the request from Route53 --> ALB depending on a particular header value. How can I add custom logic to determine the appropriate ALB?

I am free to use some other service instead of Route53 if required.

2 approaches come to mind-

  1. Using single ALB and sub-domain(say foo.domain.com)- In order to do a URI-based routing, you would need a reverse proxy like Nginx behind your ALB where you could implement URI-based routing. Something like this -

Any Domain --> ALB --> Nginx (Clustered/Active-Passive) --> Application 1 or Application 2

  1. Using multiple ALBs and sub-domains(say foo.domain.com, bar.domain.com)- Now you can create multiple target groups, 1 corr. to 1 ALB and do a sub-domain based routing. Something like this -

Domain 1 --> ALB 1 --> Application 1

Domain 2 --> ALB 2 --> Application 2

I am free to use some other CDN instead of Route53 if required.

Route53 is DNS service not the CDN

Yes, you can do the same as mentioned above. You can add the alias record to route53 and also policy keep something like weighted so it will do the load balancing too if you are expecting.

Ref doc: https://docs.aws.amazon.com/whitepapers/latest/real-time-communication-on-aws/cross-region-dns-based-load-balancing-and-failover.html

Ref for route53 : https://docs.aws.amazon.com/whitepapers/latest/real-time-communication-on-aws/cross-region-dns-based-load-balancing-and-failover.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM