HowTo: Load Balancing mit WAN-Direct-IP Netzwerk

Soll ein Load Balancer direkt im Internet stehen und nicht über einen Router verfügbar gemacht werden, muss das WAN-Direct-IP Netzwerk mit direktem Internet Zugriff ausgewählt werden.

In diesem Beispiel sollen zwei Webserver (Webserver-1 und Webserver-2) von außen hochverfügbar gemacht werden. Die Webserver veröffentlich den Port 80 (HTTP). Falls andere Ports verwendet werden, müssen diese entsprechend angepasst werden.

Load balancer unterstützen IPv4 und IPv6 im WAN-Direct-IP Netzwerk

Load Balancer in Horizon anlegen

  1. Horizon -> Network -> Load Balancers -> Create Load Balancer

Load Balancer Details

  • Name = WAN-IPv4-LB
  • Description = WAN-IPv4-LB
  • Flavor = HA (Redundanter Load Balancer) oder Single-Mode
  • Subnet = WAN-Direct-IP: 37.228.169.128/25 (WAN-Direct-IPv4)

Listener Details

  • Create Listener = Yes
  • Name = WAN-LB-Listener
  • Protocol = HTTP
  • Port = 80
  • Admin State Up = Yes

Pool Details

  • Create Pool = Yes
  • Name = WAN-LB-Pool
  • Algorithm = LEAST_CONNECTIONS (auf Wunsch ändern)
  • Admin State Up = Yes

Pool Members

  • Bei Webserver hinzufügen (Bei IP Dual-Stack im Dropdown Menü die IPv4 auswählen)
  • Port = 80

Monitor Details

  • Name = WAN-LB-Monitor
  • Type = HTTP (nach Wunsch ändern)

Create Load Balancer drücken und der Load Balancer wird erstellt.

Kontrolle des Load Balancers:

Horizon -> Network -> Load Balancers

📘

Die IP "37.228.169.147" kann nun für das load balancing der Webserver verwendet werden.

Speedrun via Openstack CLI

  1. Load Balancer anlegen
› openstack loadbalancer create --name WAN-IPv4-LB --vip-subnet-id 89f93882-2484-4fc0-9281-8b0288badfa6 --flavor 406a7541-620d-4bdf-b47f-90efc8f52a69 --wait
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| availability_zone   | None                                 |
| created_at          | 2025-01-09T11:33:49                  |
| description         |                                      |
| flavor_id           | 406a7541-620d-4bdf-b47f-90efc8f52a69 |
| id                  | d837b3bf-aa2b-4496-82d6-748ecb8f864b |
| listeners           |                                      |
| name                | WAN-IPv4-LB                          |
| operating_status    | OFFLINE                              |
| pools               |                                      |
| project_id          | 96dd74b73fc4451da99b02ee68187d2f     |
| provider            | amphora                              |
| provisioning_status | PENDING_CREATE                       |
| updated_at          | None                                 |
| vip_address         | 37.228.169.163                       |
| vip_network_id      | b6550d4d-0294-44c5-9966-bb7163939a49 |
| vip_port_id         | 3f0762e4-bea0-4f9d-936a-26ba4a4949ea |
| vip_qos_policy_id   | None                                 |
| vip_subnet_id       | 89f93882-2484-4fc0-9281-8b0288badfa6 |
| vip_vnic_type       | normal                               |
| tags                |                                      |
| additional_vips     |                                      |
+---------------------+--------------------------------------+
  1. Listener anlegen
› openstack loadbalancer listener create --name WAN-LB-Listener --protocol HTTP --protocol-port 80 --wait WAN-IPv4-LB
+-----------------------------+--------------------------------------+
| Field                       | Value                                |
+-----------------------------+--------------------------------------+
| admin_state_up              | True                                 |
| connection_limit            | -1                                   |
| created_at                  | 2025-01-09T11:37:37                  |
| default_pool_id             | None                                 |
| default_tls_container_ref   | None                                 |
| description                 |                                      |
| id                          | b5fb466e-0e59-4a9e-bbe8-d01fbae070c6 |
| insert_headers              | None                                 |
| l7policies                  |                                      |
| loadbalancers               | d837b3bf-aa2b-4496-82d6-748ecb8f864b |
| name                        | WAN-LB-Listener                      |
| operating_status            | OFFLINE                              |
| project_id                  | 96dd74b73fc4451da99b02ee68187d2f     |
| protocol                    | HTTP                                 |
| protocol_port               | 80                                   |
| provisioning_status         | ACTIVE                               |
| sni_container_refs          | []                                   |
| timeout_client_data         | 50000                                |
| timeout_member_connect      | 5000                                 |
| timeout_member_data         | 50000                                |
| timeout_tcp_inspect         | 0                                    |
| updated_at                  | 2025-01-09T11:37:39                  |
| client_ca_tls_container_ref | None                                 |
| client_authentication       | NONE                                 |
| client_crl_container_ref    | None                                 |
| allowed_cidrs               | None                                 |
| tls_ciphers                 | None                                 |
| tls_versions                | None                                 |
| alpn_protocols              | None                                 |
| tags                        |                                      |
| hsts_max_age                |                                      |
| hsts_include_subdomains     |                                      |
| hsts_preload                |                                      |
+-----------------------------+--------------------------------------+
  1. Pool anlegen
› openstack loadbalancer pool create --name WAN-LB-Pool --lb-algorithm LEAST_CONNECTIONS --listener WAN-LB-Listener --protocol HTTP --wait
+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| admin_state_up       | True                                 |
| created_at           | 2025-01-09T11:39:56                  |
| description          |                                      |
| healthmonitor_id     |                                      |
| id                   | cd88a5f7-098d-4117-a54f-defab371121d |
| lb_algorithm         | LEAST_CONNECTIONS                    |
| listeners            | b5fb466e-0e59-4a9e-bbe8-d01fbae070c6 |
| loadbalancers        | d837b3bf-aa2b-4496-82d6-748ecb8f864b |
| members              |                                      |
| name                 | WAN-LB-Pool                          |
| operating_status     | OFFLINE                              |
| project_id           | 96dd74b73fc4451da99b02ee68187d2f     |
| protocol             | HTTP                                 |
| provisioning_status  | ACTIVE                               |
| session_persistence  | None                                 |
| updated_at           | 2025-01-09T11:39:57                  |
| tls_container_ref    | None                                 |
| ca_tls_container_ref | None                                 |
| crl_container_ref    | None                                 |
| tls_enabled          | False                                |
| tls_ciphers          | None                                 |
| tls_versions         | None                                 |
| tags                 |                                      |
| alpn_protocols       | None                                 |
+----------------------+--------------------------------------+
  1. Member hinzufügen - Webserver-1
› openstack loadbalancer member create --name Webserver-1 --subnet-id 89f93882-2484-4fc0-9281-8b0288badfa6 --address 37.228.169.213 --protocol-port 80 --wait WAN-LB-Pool
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 37.228.169.213                       |
| admin_state_up      | True                                 |
| created_at          | 2025-01-09T11:54:51                  |
| id                  | efd556f4-634b-4b90-965f-798fd365a7f1 |
| name                | Webserver-1                          |
| operating_status    | OFFLINE                              |
| project_id          | 878f66de110e4e309aa0aee5475c85f1     |
| protocol_port       | 80                                   |
| provisioning_status | ACTIVE                               |
| subnet_id           | 89f93882-2484-4fc0-9281-8b0288badfa6 |
| updated_at          | 2025-01-09T11:54:54                  |
| weight              | 1                                    |
| monitor_port        | 80                                   |
| monitor_address     | 37.228.169.213                       |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+
  1. Member hinzufügen - Webserver-2
› openstack loadbalancer member create --name Webserver-1 --subnet-id 5ac7a7ec-5fc9-4033-b46f-7a9b1c3fc5f1 --address  37.228.170.151 --protocol-port 80 --wait WAN-LB-Pool
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 37.228.170.151                       |
| admin_state_up      | True                                 |
| created_at          | 2025-01-09T11:56:47                  |
| id                  | ceda11df-d3dd-4747-ac89-8e69c5c7270f |
| name                | Webserver-1                          |
| operating_status    | ONLINE                               |
| project_id          | 878f66de110e4e309aa0aee5475c85f1     |
| protocol_port       | 80                                   |
| provisioning_status | ACTIVE                               |
| subnet_id           | 5ac7a7ec-5fc9-4033-b46f-7a9b1c3fc5f1 |
| updated_at          | 2025-01-09T11:56:52                  |
| weight              | 1                                    |
| monitor_port        | 80                                   |
| monitor_address     | 37.228.170.151                       |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+
  1. Health Monitor hinzufügen
› openstack loadbalancer healthmonitor create --name WAN-LB-Monitor --delay 5 --max-retries 3 --timeout 5 --type HTTP --url-path / --wait WAN-LB-Pool
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| project_id          | 878f66de110e4e309aa0aee5475c85f1     |
| name                | http-monitor                         |
| admin_state_up      | True                                 |
| pools               | 22d61dfb-4be9-4d24-861c-d285761cba53 |
| created_at          | 2025-01-09T11:57:50                  |
| provisioning_status | ACTIVE                               |
| updated_at          | 2025-01-09T11:57:51                  |
| delay               | 5                                    |
| expected_codes      | 200                                  |
| max_retries         | 4                                    |
| http_method         | GET                                  |
| timeout             | 10                                   |
| max_retries_down    | 3                                    |
| url_path            | /healthcheck                         |
| type                | HTTP                                 |
| id                  | 4758f019-9be2-4942-8f42-f6668e89bdbf |
| operating_status    | ONLINE                               |
| http_version        | None                                 |
| domain_name         | None                                 |
| tags                |                                      |
+---------------------+--------------------------------------+