Ubuntu 24.04
Sponsored Link

OpenStack Dalmatian : How to use Octavia2024/10/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           |
+--------------------+----------------+---------------------+------------------+
| 22837749-299e-     | public-subnet  | ce38ba4f-6066-4e93- | 10.0.0.0/24      |
| 4323-bfc3-         |                | ae59-de238fb6ed08   |                  |
| 3120c8c2d635       |                |                     |                  |
| bc45dd3e-0b15-     | private-subnet | 2da36a04-0d3e-4de8- | 192.168.100.0/24 |
| 42ca-a37b-         |                | 9be8-a2972c15bbe4   |                  |
| 94f2feaf341e       |                |                     |                  |
+--------------------+----------------+---------------------+------------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| availability_zone   | None                                 |
| created_at          | 2024-10-24T00:44:44                  |
| description         |                                      |
| flavor_id           | None                                 |
| id                  | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| listeners           |                                      |
| name                | lb01                                 |
| operating_status    | OFFLINE                              |
| pools               |                                      |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| provider            | amphora                              |
| provisioning_status | PENDING_CREATE                       |
| updated_at          | None                                 |
| vip_address         | 192.168.100.34                       |
| vip_network_id      | 2da36a04-0d3e-4de8-9be8-a2972c15bbe4 |
| vip_port_id         | f59bb54b-a37a-4bce-a5b5-db663df8f190 |
| vip_qos_policy_id   | None                                 |
| vip_subnet_id       | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| vip_vnic_type       | normal                               |
| 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 |
+-----------+------+------------+-------------+---------------------+------------------+----------+
| 91b072b8- | lb01 | 84e315c8d6 | 192.168.100 | ACTIVE              | OFFLINE          | amphora  |
| e06a-     |      | 5e4b3cb33a | .34         |                     |                  |          |
| 48e4-     |      | af69c9eed0 |             |                     |                  |          |
| b6e8-     |      | c3         |             |                     |                  |          |
| 37c1ea389 |      |            |             |                     |                  |          |
| 9c6       |      |            |             |                     |                  |          |
+-----------+------+------------+-------------+---------------------+------------------+----------+
[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                  | 2024-10-24T00:47:16                  |
| default_pool_id             | None                                 |
| default_tls_container_ref   | None                                 |
| description                 |                                      |
| id                          | f562d192-85bc-4db6-96e4-2e0fb1bca232 |
| insert_headers              | None                                 |
| l7policies                  |                                      |
| loadbalancers               | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| name                        | listener01                           |
| operating_status            | OFFLINE                              |
| project_id                  | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| 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           | 2024-10-24T00:47:49                  |
| description          |                                      |
| healthmonitor_id     |                                      |
| id                   | 0e9135cd-31f9-434e-a2d7-9dc63d62e7ff |
| lb_algorithm         | ROUND_ROBIN                          |
| listeners            | f562d192-85bc-4db6-96e4-2e0fb1bca232 |
| loadbalancers        | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| members              |                                      |
| name                 | pool01                               |
| operating_status     | OFFLINE                              |
| project_id           | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| 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   |
+------------------+-------+--------+------------------+------------+----------+
| fb215355-6d93-   | Web02 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4d73-bc99-       |       |        | 100.138          |            |          |
| 453a9c674d62     |       |        |                  |            |          |
| 605d794e-6cbd-   | Web01 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4cea-abc2-       |       |        | 100.181          |            |          |
| 5a1074ccec70     |       |        |                  |            |          |
+------------------+-------+--------+------------------+------------+----------+

# add web server instances to the pool member

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.138                      |
| admin_state_up      | True                                 |
| created_at          | 2024-10-24T01:02:53                  |
| id                  | 9172971b-f525-4ace-ac9c-5c53c9052bc2 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| 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.181 --protocol-port 80 pool01

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.181                      |
| admin_state_up      | True                                 |
| created_at          | 2024-10-24T01:03:07                  |
| id                  | dadcb676-5dcc-40d3-958b-3232b0ea3996 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| 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 |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+
| 9172971b |      | 84e315c8d6 | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -f525-   |      | 5e4b3cb33a |                     | 100.138  |               |                  |        |
| 4ace-ac9 |      | af69c9eed0 |                     |          |               |                  |        |
| c-       |      | c3         |                     |          |               |                  |        |
| 5c53c905 |      |            |                     |          |               |                  |        |
| 2bc2     |      |            |                     |          |               |                  |        |
| dadcb676 |      | 84e315c8d6 | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -5dcc-   |      | 5e4b3cb33a |                     | 100.181  |               |                  |        |
| 40d3-    |      | af69c9eed0 |                     |          |               |                  |        |
| 958b-    |      | c3         |                     |          |               |                  |        |
| 3232b0ea |      |            |                     |          |               |                  |        |
| 3996     |      |            |                     |          |               |                  |        |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+

# create a floating IP on public network

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2024-10-24T01:04:03Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.228                           |
| floating_network_id | ce38ba4f-6066-4e93-ae59-de238fb6ed08 |
| id                  | 0d4efa8e-68d0-42be-a908-c76202b33f3f |
| name                | 10.0.0.228                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2024-10-24T01:04:03Z                 |
+---------------------+--------------------------------------+

# 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.228
# verify settings to access to the floating IP

ubuntu@dlp ~(keystone)$
curl 10.0.0.228

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

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

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

Web Server on Instance02
Matched Content