Running multiple tunnels against a load balancer

Hi,
I’m assuming that we could run multiple tunnels with the same tunnel id and connected that to a load balancer. And the load balancer would then choose which tunnel and therefore which service instance to route the traffic too. Is that right?

Also, can a load balance direct traffic to the multiple subdomains. So one load balancer that sends traffic to a.domain and b.domain?

Therefore the setup would be to have where multiple subdomains connected to the one load balancer and the load balancer would connect to the multiple server instances per subdomain via argo tunnels.

subdomain(A), subdomain(B) <-> Loadbalancer <-> app1 (for subdomain A, tunnel ID 123), app2 (for subdomain A, tunnel ID 123), app1 (for subdomain B, tunnel ID 456), app2 (for subdomain B, tunnel ID 456)

Thanks for your help

No, it is not possible to run the same tunnel ID in multiple cloudflareds. You will get an error if you try to do so.

If you have replicas of your origin service(s), then you’d run different named tunnels in each, and route them all to the same LB pool.

Something like:

// ran in some admin machine
cloudflared tunnel create replica-1
cloudflared tunnel create replica-2
// assumes that mylb is a Cloudflare Load Balancer that was previously created (e.g. via Cloudflare dashboard)
cloudflared tunnel route lb replica-1 mylb replicas-lb-pool
cloudflared tunnel route lb replica-2 mylb replicas-lb-pool
// now take the UUID.json credentials file for replica-1 and replica-2, put them on machine-1 and 2 respectively, and run the tunnel there
cloudflared tunnel run replica-1/2

With that, your replicated origins will be reachable via the LB hostname that will route between the tunnels (depending on your steering traffic policy).

Also, can a load balance direct traffic to the multiple subdomains. So one load balancer that sends traffic to a.domain and b.domain?

The LB is agnostic of what each origin is. Whatever you give to the LB, it will steer among those origins.

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.