OpenStack Epoxy : How to use Octavia |
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) |
| debian@dlp ~(keystone)$ openstack subnet list +--------------------+----------------+---------------------+------------------+ | ID | Name | Network | Subnet | +--------------------+----------------+---------------------+------------------+ | 319013fd-5412- | public-subnet | 7de3878f-814f-4909- | 10.0.0.0/24 | | 4cce- | | b4e6-d4dc1c740577 | | | bb87-49f5a0c91b0e | | | | | bb5efd0a-ea4d- | private-subnet | d442015a-b6f6-4349- | 192.168.100.0/24 | | 42ee-99ca- | | 890b-c08eb5366a4d | | | 97cee2f56ca2 | | | | +--------------------+----------------+---------------------+------------------+debian@dlp ~(keystone)$ openstack loadbalancer create --name lb01 --vip-subnet-id private-subnet +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | admin_state_up | True | | availability_zone | None | | created_at | 2025-09-02T01:33:11 | | description | | | flavor_id | None | | id | 6c167adb-152d-4bce-a823-84920d1c9e1f | | listeners | | | name | lb01 | | operating_status | OFFLINE | | pools | | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | provider | amphora | | provisioning_status | PENDING_CREATE | | updated_at | None | | vip_address | 192.168.100.196 | | vip_network_id | d442015a-b6f6-4349-890b-c08eb5366a4d | | vip_port_id | 204221e0-3a01-4801-957b-958aef3688fc | | vip_qos_policy_id | None | | vip_subnet_id | bb5efd0a-ea4d-42ee-99ca-97cee2f56ca2 | | vip_vnic_type | normal | | vip_sg_ids | [] | | tags | | | additional_vips | [] | +---------------------+--------------------------------------+ # after a few minutes, status turns to [ACTIVE] if instance successfully created debian@dlp ~(keystone)$ openstack loadbalancer list +-----------+------+------------+-------------+---------------------+------------------+----------+ | id | name | project_id | vip_address | provisioning_status | operating_status | provider | +-----------+------+------------+-------------+---------------------+------------------+----------+ | 6c167adb- | lb01 | ecfa98ba82 | 192.168.100 | ACTIVE | OFFLINE | amphora | | 152d- | | de421e8f16 | .196 | | | | | 4bce- | | c3d862b5ab | | | | | | a823- | | 04 | | | | | | 84920d1c9 | | | | | | | | e1f | | | | | | | +-----------+------+------------+-------------+---------------------+------------------+----------+ |
| [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 debian@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-09-02T01:35:06 | | default_pool_id | None | | default_tls_container_ref | None | | description | | | id | eaf4cfbc-4b20-4259-a1d0-254e87f8d4ee | | insert_headers | None | | l7policies | | | loadbalancers | 6c167adb-152d-4bce-a823-84920d1c9e1f | | name | listener01 | | operating_status | OFFLINE | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | 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 debian@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-09-02T01:35:30 | | description | | | healthmonitor_id | | | id | 9dea66ef-a0ed-4b17-b75e-0eb050e0b587 | | lb_algorithm | ROUND_ROBIN | | listeners | eaf4cfbc-4b20-4259-a1d0-254e87f8d4ee | | loadbalancers | 6c167adb-152d-4bce-a823-84920d1c9e1f | | members | | | name | pool01 | | operating_status | OFFLINE | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | 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 debian@dlp ~(keystone)$ openstack server list +-------------------+-------+--------+-------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +-------------------+-------+--------+-------------------+----------+----------+ | 14834f3d-852e- | Web02 | ACTIVE | private=192.168.1 | Debian13 | m1.small | | 4e51-ab82- | | | 00.152 | | | | 2479d465ad32 | | | | | | | 4ed4d84a-e910- | Web01 | ACTIVE | private=192.168.1 | Debian13 | m1.small | | 4fc9-bf5e- | | | 00.178 | | | | 6eb812fa9426 | | | | | | +-------------------+-------+--------+-------------------+----------+----------+ # add web server instances to the pool member debian@dlp ~(keystone)$ openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.152 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.152 | | admin_state_up | True | | created_at | 2025-09-02T01:45:32 | | id | 2830c612-64b0-4f24-a1af-20098dd1edf8 | | name | | | operating_status | NO_MONITOR | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | bb5efd0a-ea4d-42ee-99ca-97cee2f56ca2 | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | | tags | | | vnic_type | normal | +---------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.178 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.178 | | admin_state_up | True | | created_at | 2025-09-02T01:45:57 | | id | eee5e127-480f-4fcb-823b-6e82ac32bc62 | | name | | | operating_status | NO_MONITOR | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | bb5efd0a-ea4d-42ee-99ca-97cee2f56ca2 | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | | tags | | | vnic_type | normal | +---------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack loadbalancer member list pool01 +----------+------+------------+---------------------+----------+---------------+------------------+--------+ | id | name | project_id | provisioning_status | address | protocol_port | operating_status | weight | +----------+------+------------+---------------------+----------+---------------+------------------+--------+ | 2830c612 | | ecfa98ba82 | ACTIVE | 192.168. | 80 | NO_MONITOR | 1 | | -64b0- | | de421e8f16 | | 100.152 | | | | | 4f24- | | c3d862b5ab | | | | | | | a1af- | | 04 | | | | | | | 20098dd1 | | | | | | | | | edf8 | | | | | | | | | eee5e127 | | ecfa98ba82 | ACTIVE | 192.168. | 80 | NO_MONITOR | 1 | | -480f- | | de421e8f16 | | 100.178 | | | | | 4fcb- | | c3d862b5ab | | | | | | | 823b- | | 04 | | | | | | | 6e82ac32 | | | | | | | | | bc62 | | | | | | | | +----------+------+------------+---------------------+----------+---------------+------------------+--------+ # create a floating IP on public network debian@dlp ~(keystone)$ openstack floating ip create public +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | created_at | 2025-09-02T01:46:34Z | | description | | | dns_domain | | | dns_name | | | fixed_ip_address | None | | floating_ip_address | 10.0.0.206 | | floating_network_id | 7de3878f-814f-4909-b4e6-d4dc1c740577 | | id | 0142466c-9438-4907-a14d-8bdd6110efab | | name | 10.0.0.206 | | port_details | None | | port_id | None | | project_id | ecfa98ba82de421e8f16c3d862b5ab04 | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2025-09-02T01:46:34Z | +---------------------+--------------------------------------+ # associate floating IP with VIP of loadbalancer instace debian@dlp ~(keystone)$ VIPPORT=$(openstack loadbalancer show lb01 | grep vip_port_id | awk {'print $4'}) debian@dlp ~(keystone)$ openstack floating ip set --port $VIPPORT 10.0.0.206 # verify settings to access to the floating IP debian@dlp ~(keystone)$ curl 10.0.0.206 Web Server on Instance01 debian@dlp ~(keystone)$ curl 10.0.0.206 Web Server on Instance02 debian@dlp ~(keystone)$ curl 10.0.0.206 Web Server on Instance01 debian@dlp ~(keystone)$ curl 10.0.0.206 Web Server on Instance02 |
Matched Content
No comments:
Post a Comment