Ubuntu 24.04
Sponsored Link

OpenStack Epoxy : How to use Octavia2025/04/24

 

Install and Configure OpenStack Load Balancing as a Service (Octavia).

This example is based on the environment like follows.

------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |      Open vSwitch     |  |        Libvirt        |
|  Memcached  Nginx     |  |     Neutron Server    |  |      Nova Compute     |
|  Keystone   httpd     |  |      OVN-Northd       |  |      Open vSwitch     |
|  Glance     Nova API  |  |  Nginx  iSCSI Target  |  |   OVN Metadata Agent  |
|  Cinder API           |  |     Cinder Volume     |  |     OVN-Controller    |
|                       |  |    Octavia Services   |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Install Octavia client tool.
root@dlp ~(keystone)#
apt -y install python3-octaviaclient
[2] Login as any Openstack user and create Loadbalancer instance.
It's OK to work on any node. (example below is on Control Node)
ubuntu@dlp ~(keystone)$
openstack subnet list

+--------------------+----------------+---------------------+------------------+
| ID                 | Name           | Network             | Subnet           |
+--------------------+----------------+---------------------+------------------+
| b691b066-62df-     | public-subnet  | cb803bda-6f08-4ae3- | 10.0.0.0/24      |
| 45be-a5ee-         |                | 9018-1c4320ad0295   |                  |
| 911e347174ba       |                |                     |                  |
| daeaa092-2e5d-     | private-subnet | fb4dc320-1981-4914- | 192.168.100.0/24 |
| 44de-9de4-         |                | 9d3f-f8fd757c4562   |                  |
| 51bea52b51b4       |                |                     |                  |
+--------------------+----------------+---------------------+------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer create --name lb01 --vip-subnet-id private-subnet

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| availability_zone   | None                                 |
| created_at          | 2025-04-24T03:48:19                  |
| description         |                                      |
| flavor_id           | None                                 |
| id                  | 7278be40-5516-43a5-90ff-bd6c83dca145 |
| listeners           |                                      |
| name                | lb01                                 |
| operating_status    | OFFLINE                              |
| pools               |                                      |
| project_id          | 407400ec8d16434e9badf4ceb9d71f1e     |
| provider            | amphora                              |
| provisioning_status | PENDING_CREATE                       |
| updated_at          | None                                 |
| vip_address         | 192.168.100.165                      |
| vip_network_id      | fb4dc320-1981-4914-9d3f-f8fd757c4562 |
| vip_port_id         | 52f4cd2e-554f-49f9-a68f-63ea51b334fe |
| vip_qos_policy_id   | None                                 |
| vip_subnet_id       | daeaa092-2e5d-44de-9de4-51bea52b51b4 |
| vip_vnic_type       | normal                               |
| vip_sg_ids          | []                                   |
| tags                |                                      |
| additional_vips     | []                                   |
+---------------------+--------------------------------------+

# after a few minutes, status turns to [ACTIVE] if instance successfully created

ubuntu@dlp ~(keystone)$
openstack loadbalancer list

+-----------+------+------------+-------------+---------------------+------------------+----------+
| id        | name | project_id | vip_address | provisioning_status | operating_status | provider |
+-----------+------+------------+-------------+---------------------+------------------+----------+
| 7278be40- | lb01 | 407400ec8d | 192.168.100 | ACTIVE              | OFFLINE          | amphora  |
| 5516-     |      | 16434e9bad | .165        |                     |                  |          |
| 43a5-     |      | f4ceb9d71f |             |                     |                  |          |
| 90ff-bd6c |      | 1e         |             |                     |                  |          |
| 83dca145  |      |            |             |                     |                  |          |
+-----------+------+------------+-------------+---------------------+------------------+----------+
[3] Add a listener and pool to the instance and Configure loadbalancing to use 2 backend Web Server instances.
# create a listener that listens TCP 80

ubuntu@dlp ~(keystone)$
openstack loadbalancer listener create --name listener01 --protocol TCP --protocol-port 80 lb01

+-----------------------------+--------------------------------------+
| Field                       | Value                                |
+-----------------------------+--------------------------------------+
| admin_state_up              | True                                 |
| connection_limit            | -1                                   |
| created_at                  | 2025-04-24T03:50:48                  |
| default_pool_id             | None                                 |
| default_tls_container_ref   | None                                 |
| description                 |                                      |
| id                          | 12c973a0-ff14-4ff8-875b-2c5d7a207f11 |
| insert_headers              | None                                 |
| l7policies                  |                                      |
| loadbalancers               | 7278be40-5516-43a5-90ff-bd6c83dca145 |
| name                        | listener01                           |
| operating_status            | OFFLINE                              |
| project_id                  | 407400ec8d16434e9badf4ceb9d71f1e     |
| protocol                    | TCP                                  |
| protocol_port               | 80                                   |
| provisioning_status         | PENDING_CREATE                       |
| sni_container_refs          | []                                   |
| timeout_client_data         | 50000                                |
| timeout_member_connect      | 5000                                 |
| timeout_member_data         | 50000                                |
| timeout_tcp_inspect         | 0                                    |
| updated_at                  | None                                 |
| 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                | None                                 |
| hsts_include_subdomains     | False                                |
| hsts_preload                | False                                |
+-----------------------------+--------------------------------------+

# add a pool to the listener

ubuntu@dlp ~(keystone)$
openstack loadbalancer pool create --name pool01 --lb-algorithm ROUND_ROBIN --listener listener01 --protocol TCP

+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| admin_state_up       | True                                 |
| created_at           | 2025-04-24T03:51:12                  |
| description          |                                      |
| healthmonitor_id     |                                      |
| id                   | e5439347-3764-4833-8758-dabf0885166e |
| lb_algorithm         | ROUND_ROBIN                          |
| listeners            | 12c973a0-ff14-4ff8-875b-2c5d7a207f11 |
| loadbalancers        | 7278be40-5516-43a5-90ff-bd6c83dca145 |
| members              |                                      |
| name                 | pool01                               |
| operating_status     | OFFLINE                              |
| project_id           | 407400ec8d16434e9badf4ceb9d71f1e     |
| protocol             | TCP                                  |
| provisioning_status  | PENDING_CREATE                       |
| session_persistence  | None                                 |
| updated_at           | None                                 |
| 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                                 |
+----------------------+--------------------------------------+

# web server instances

ubuntu@dlp ~(keystone)$
openstack server list

+------------------+-------+--------+------------------+------------+----------+
| ID               | Name  | Status | Networks         | Image      | Flavor   |
+------------------+-------+--------+------------------+------------+----------+
| 6dc1fdf5-d514-   | Web02 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4e3e-a7a9-       |       |        | 100.244          |            |          |
| 3aaecb508f5b     |       |        |                  |            |          |
| 9e84e297-32cf-   | Web01 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4ce9-8db7-       |       |        | 100.249          |            |          |
| 5b5e5c8d0c6f     |       |        |                  |            |          |
+------------------+-------+--------+------------------+------------+----------+

# add web server instances to the pool member

ubuntu@dlp ~(keystone)$
openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.244 --protocol-port 80 pool01

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.244                      |
| admin_state_up      | True                                 |
| created_at          | 2025-04-24T04:04:54                  |
| id                  | a7774237-cad4-49e4-a9ba-3c2ed05cc20e |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 407400ec8d16434e9badf4ceb9d71f1e     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | daeaa092-2e5d-44de-9de4-51bea52b51b4 |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.249 --protocol-port 80 pool01

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.249                      |
| admin_state_up      | True                                 |
| created_at          | 2025-04-24T04:05:12                  |
| id                  | df3d6bac-0435-48b2-b9b0-197080095ce9 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 407400ec8d16434e9badf4ceb9d71f1e     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | daeaa092-2e5d-44de-9de4-51bea52b51b4 |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer member list pool01

+----------+------+------------+---------------------+----------+---------------+------------------+--------+
| id       | name | project_id | provisioning_status | address  | protocol_port | operating_status | weight |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+
| a7774237 |      | 407400ec8d | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -cad4-   |      | 16434e9bad |                     | 100.244  |               |                  |        |
| 49e4-    |      | f4ceb9d71f |                     |          |               |                  |        |
| a9ba-    |      | 1e         |                     |          |               |                  |        |
| 3c2ed05c |      |            |                     |          |               |                  |        |
| c20e     |      |            |                     |          |               |                  |        |
| df3d6bac |      | 407400ec8d | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -0435-   |      | 16434e9bad |                     | 100.249  |               |                  |        |
| 48b2-    |      | f4ceb9d71f |                     |          |               |                  |        |
| b9b0-    |      | 1e         |                     |          |               |                  |        |
| 19708009 |      |            |                     |          |               |                  |        |
| 5ce9     |      |            |                     |          |               |                  |        |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+

# create a floating IP on public network

ubuntu@dlp ~(keystone)$
openstack floating ip create public

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2025-04-24T04:06:12Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.205                           |
| floating_network_id | cb803bda-6f08-4ae3-9018-1c4320ad0295 |
| id                  | 9468535c-906e-4152-bce3-2f291ffec233 |
| name                | 10.0.0.205                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 407400ec8d16434e9badf4ceb9d71f1e     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2025-04-24T04:06:12Z                 |
+---------------------+--------------------------------------+

# associate floating IP with VIP of loadbalancer instace

ubuntu@dlp ~(keystone)$
VIPPORT=$(openstack loadbalancer show lb01 | grep vip_port_id | awk {'print $4'})

ubuntu@dlp ~(keystone)$
openstack floating ip set --port $VIPPORT 10.0.0.205
# verify settings to access to the floating IP

ubuntu@dlp ~(keystone)$
curl 10.0.0.205

Web Server on Instance01
ubuntu@dlp ~(keystone)$
curl 10.0.0.205

Web Server on Instance02
ubuntu@dlp ~(keystone)$
curl 10.0.0.205

Web Server on Instance01
ubuntu@dlp ~(keystone)$
curl 10.0.0.205

Web Server on Instance02
Matched Content