Skip to content

Commit c7711dc

Browse files
committed
explain diagrams
1 parent c503c9c commit c7711dc

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

src/content/docs/cloudflare-one/connections/connect-networks/routing-to-tunnel/public-load-balancers.mdx

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 3
66
---
77

8-
import { Render, DashButton } from "~/components";
8+
import { Render, DashButton, Details } from "~/components";
99

1010
A [public load balancer](/load-balancing/load-balancers/) allows you to distribute traffic across the servers that are running your [published applications](/cloudflare-one/connections/connect-networks/routing-to-tunnel/).
1111

@@ -16,7 +16,6 @@ When you add a [published application route](/cloudflare-one/connections/connect
1616
### Prerequisites
1717

1818
- A Cloudflare Tunnel with a [published application route](/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/#2a-publish-an-application)
19-
- A `CNAME` DNS record that points the application hostname (`app.example.com`) to `<UUID>.cfargotunnel.com`. This DNS record is automatically created for routes configured through the dashboard. Routes configured via the API or CLI require [manually creating the record](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/).
2019

2120
### Create a load balancer
2221

@@ -36,25 +35,38 @@ To create a load balancer for Cloudflare Tunnel published applications:
3635
- **Endpoint Address**: `<UUID>.cfargotunnel.com`, where `<UUID>` is replaced by your Tunnel ID. You can find the **Tunnel ID** in [Zero Trust](https://one.dash.cloudflare.com) under **Networks** > **Tunnels**.
3736
- **Header value**: Hostname of your published application route (such as `app.example.com`). To find the hostname value, open your tunnel configuration and go to the **Published application routes** tab.
3837
- **Weight**: Assign a [weight](/load-balancing/understand-basics/traffic-steering/origin-level-steering/#weights) to the endpoint. If you only have one endpoint, enter `1`.
39-
9. (Recommended) On the **Monitors** page, attach a monitor to the tunnel endpoint. You can create the following monitor to check if the application is reachable:
38+
:::note
39+
A single origin pool cannot have the same Tunnel UUID referenced twice.
40+
:::
41+
9. (Recommended) On the **Monitors** page, attach a monitor to the tunnel endpoint. For example, if your application is HTTP or HTTPS, you can create an HTTPS monitor to poll the application:
4042
- **Type**: _HTTPS_
4143
- **Path**: `/`
4244
- **Port**: `443`
4345
- **Expected Code(s)**: `200`
4446
- **Header Name**: `Host`
4547
- **Value**: `app.example.com`
4648

49+
:::note
50+
TCP monitors are not supported for tunnel endpoints. For a workaround, refer to [Monitors and TCP tunnel origins](#monitors-and-tcp-tunnel-origins).
51+
:::
52+
4753
10. Save and deploy the load balancer.
54+
11. To test the load balancer, access the application using the load balancer hostname (`lb.example.com`).
4855

49-
To test the load balancer, access the application using the load balancer hostname (`lb.example.com`).
56+
Refer to the [Load Balancing documentation](/load-balancing/) for more details on load balancer settings and configurations.
5057

5158
### Optional Cloudflare settings
5259

5360
The application will default to the Cloudflare settings for the load balancer hostname, including [cache rules](/cache/how-to/cache-rules/) and [firewall policies](/firewall/). You can change the settings for your hostname in the [Cloudflare dashboard](https://dash.cloudflare.com/).
5461

5562
## Common architectures
5663

64+
Review common load balancing configurations for Cloudflare Tunnel published applications.
65+
5766
### One tunnel per region
67+
68+
For this example, assume we have a web application that runs on servers in two different data centers. We want to connect the application to Cloudflare so that users can access the application from anywhere in the world. Additionally, we want Cloudflare to load balance between the servers such that if the primary server fails, the secondary server receives all traffic.
69+
5870
```mermaid
5971
graph LR
6072
subgraph LB["Public load balancer <br> app.example.com "]
@@ -86,14 +98,18 @@ graph LR
8698
style r2 stroke-dasharray: 5 5
8799
```
88100

89-
Only valid for active-standby setups, since each pool has only one endpoint.
90-
91-
Note: A single origin pool in LB can't have the same Tunnel GUID referenced twice
101+
As shown in the diagram, a typical setup includes:
102+
- A dedicated Cloudflare Tunnel per data center.
103+
- One load balancer pool per tunnel.
104+
- One load balancer endpoint per pool, where the host header is set to the `cloudflared` published application hostname.
105+
- At least two `cloudflared` [replicas](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-availability/#cloudflared-replicas) per tunnel in their respective data centers, in case a `cloudflared` host machine goes down.
92106

93-
Deploy replicas for server redundancy. replicas operate in pooled mode.
107+
Users will access the application using the load balancer hostname (`app.example.com`). Note that this setup is only valid for [Active-Passive failover](/load-balancing/load-balancers/common-configurations/#active---passive-failover), since each pool only supports one endpoint per tunnel.
94108

95109
### Multiple apps per tunnel
96110

111+
The following diagram illustrates how to load balance traffic to two different applications on a private network.
112+
97113
```mermaid
98114
graph LR
99115
subgraph LB["Public load balancer <br> lb.example.com"]
@@ -125,12 +141,21 @@ graph LR
125141
end
126142
```
127143

128-
good for an [Active-active](/load-balancing/load-balancers/common-configurations/#active---active-failover) setup which distributes traffic to endpoints in the same pool
129-
Active-active uses all available instances to process requests simultaneously, providing better performance and scalability by load-balancing traffic across them
144+
This setup includes:
130145

146+
- Two Cloudflare Tunnels with identical routes to both applications.
147+
- One load balancer pool per application.
148+
- Each load balancer pool has an endpoint per tunnel.
149+
- A [DNS record](#dns-records) for each application that points to the load balancer hostname.
131150

132-
Routes configured via the dashboard will automatically generate a `CNAME` record in the DNS zone that points to `<UUID>.cfargotunnel.com`. For example, if you add a tunnel route that points `app.example.com` to `localhost:80`, Cloudflare creates a `CNAME` record that points `app.example.com` to `<UUID.cfargotunnel.com`.
133-
Auto-generated DNS records:
151+
Users can now access all applications through the load balancer. Since there are multiple tunnel endpoints per pool, this configuration supports [Active-Active Failover](/load-balancing/load-balancers/common-configurations/#active---active-failover). Active-Active uses all available endpoints in the pool to process requests simultaneously, providing better performance and scalability by load-balancing traffic across them.
152+
153+
#### DNS records
154+
155+
When you configure a published application route via the dashboard, Cloudflare will automatically generate a `CNAME` DNS record that points the application hostname (`app1.example.com`) to `<UUID>.cfargotunnel.com`. You can [edit these DNS records](/dns/manage-dns-records/how-to/create-dns-records/#edit-dns-records) so that they point to the load balancer hostname instead.
156+
157+
<Details header="Example" open={true}>
158+
Auto-generated DNS records after setting up [Multiple apps per tunnel](#multiple-apps-per-tunnel):
134159

135160
| Type | Name | Content |
136161
| ---- | ---- | ------- |
@@ -148,6 +173,12 @@ Updated DNS records:
148173
| CNAME | app1 | `lb.example.com` |
149174
| CNAME | app2 | `lb.example.com` |
150175

176+
</Details>
177+
178+
:::note
179+
Tunnel routes configured via the API or CLI require [manually creating the DNS record](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/).
180+
:::
181+
151182
## Known limitations
152183

153184
### Monitors and TCP tunnel origins

0 commit comments

Comments
 (0)