OpenStack Yoga : How to use Octavia2022/06/02 |
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 httpd | | Neutron Server | | Nova Compute | | Keystone Glance | | OVN-Northd | | Open vSwitch | | Nova API Cinder API | | Cinder Volume | | OVN Metadata Agent | | | | Octavia Services | | OVN-Controller | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | Create a Loadbalancer instance. By default, [admin] users can create instances, so work as an admin user. It's OK to work on any node. (example below is on Control Node) |
[root@dlp ~(keystone)]# openstack subnet list +--------------------------------------+----------------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+----------------+--------------------------------------+------------------+ | 748c0a25-c6d8-48fd-829e-8b15783b7f8a | private-subnet | 0f0af4c7-f2d1-4c13-b30c-4619ff33db0c | 192.168.100.0/24 | | e20328ce-a24a-4804-be39-88f18800526f | public-subnet | 0c96d581-95f3-4e72-9626-d0a94407d0ec | 10.0.0.0/24 | +--------------------------------------+----------------+--------------------------------------+------------------+[root@dlp ~(keystone)]# openstack loadbalancer create --name lb01 --vip-subnet-id private-subnet +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | admin_state_up | True | | availability_zone | None | | created_at | 2022-06-02T00:39:34 | | description | | | flavor_id | None | | id | 7024faa2-4487-495d-a833-f78e26622ab0 | | listeners | | | name | lb01 | | operating_status | OFFLINE | | pools | | | project_id | 0609d3b3b398456187fb705ec9224c4a | | provider | amphora | | provisioning_status | PENDING_CREATE | | updated_at | None | | vip_address | 192.168.100.23 | | vip_network_id | 0f0af4c7-f2d1-4c13-b30c-4619ff33db0c | | vip_port_id | 70676600-fd2a-4c82-ad6d-c0aa5886da14 | | vip_qos_policy_id | None | | vip_subnet_id | 748c0a25-c6d8-48fd-829e-8b15783b7f8a | | tags | | +---------------------+--------------------------------------+ # after a few minutes, stauts turns to [ACTIVE] if instance successfully created [root@dlp ~(keystone)]# openstack loadbalancer list +--------------------------------------+------+----------------------------------+----------------+---------------------+------------------+----------+ | id | name | project_id | vip_address | provisioning_status | operating_status | provider | +--------------------------------------+------+----------------------------------+----------------+---------------------+------------------+----------+ | 7024faa2-4487-495d-a833-f78e26622ab0 | lb01 | 0609d3b3b398456187fb705ec9224c4a | 192.168.100.23 | ACTIVE | OFFLINE | amphora | +--------------------------------------+------+----------------------------------+----------------+---------------------+------------------+----------+ |
[2] | 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 [root@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 | 2022-06-02T00:42:54 | | default_pool_id | None | | default_tls_container_ref | None | | description | | | id | e2631ced-b3fa-4226-8457-469bb3084842 | | insert_headers | None | | l7policies | | | loadbalancers | 7024faa2-4487-495d-a833-f78e26622ab0 | | name | listener01 | | operating_status | OFFLINE | | project_id | 0609d3b3b398456187fb705ec9224c4a | | 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 | | +-----------------------------+--------------------------------------+ # add a pool to the listener [root@dlp ~(keystone)]# openstack loadbalancer pool create --name pool01 --lb-algorithm ROUND_ROBIN --listener listener01 --protocol TCP +----------------------+--------------------------------------+ | Field | Value | +----------------------+--------------------------------------+ | admin_state_up | True | | created_at | 2022-06-02T00:46:13 | | description | | | healthmonitor_id | | | id | ca87815e-8cfe-48c6-9a07-8fc28c15ad5e | | lb_algorithm | ROUND_ROBIN | | listeners | e2631ced-b3fa-4226-8457-469bb3084842 | | loadbalancers | 7024faa2-4487-495d-a833-f78e26622ab0 | | members | | | name | pool01 | | operating_status | OFFLINE | | project_id | 0609d3b3b398456187fb705ec9224c4a | | 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 [root@dlp ~(keystone)]# openstack server list +--------------------------------------+-------+--------+-------------------------+-----------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------+--------+-------------------------+-----------------+----------+ | a728d98e-566f-4841-98ff-7373e6d598d5 | Web02 | ACTIVE | private=192.168.100.128 | CentOS-Stream-8 | m1.small | | 8f14c86f-2074-4b3e-801b-1ae71da58cec | Web01 | ACTIVE | private=192.168.100.46 | CentOS-Stream-8 | m1.small | +--------------------------------------+-------+--------+-------------------------+-----------------+----------+ # add web server instances to the pool member [root@dlp ~(keystone)]# openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.128 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.128 | | admin_state_up | True | | created_at | 2022-06-02T00:49:51 | | id | 3f09abfb-dfcb-49de-adab-77f31539d476 | | name | | | operating_status | NO_MONITOR | | project_id | 0609d3b3b398456187fb705ec9224c4a | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | 748c0a25-c6d8-48fd-829e-8b15783b7f8a | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | | tags | | +---------------------+--------------------------------------+[root@dlp ~(keystone)]# openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.46 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.46 | | admin_state_up | True | | created_at | 2022-06-02T00:50:20 | | id | 3924c65e-50d9-4bb9-9d67-e0c17a0f517f | | name | | | operating_status | NO_MONITOR | | project_id | 0609d3b3b398456187fb705ec9224c4a | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | 748c0a25-c6d8-48fd-829e-8b15783b7f8a | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | | tags | | +---------------------+--------------------------------------+[root@dlp ~(keystone)]# openstack loadbalancer member list pool01 +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ | id | name | project_id | provisioning_status | address | protocol_port | operating_status | weight | +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ | 3f09abfb-dfcb-49de-adab-77f31539d476 | | 0609d3b3b398456187fb705ec9224c4a | ACTIVE | 192.168.100.128 | 80 | NO_MONITOR | 1 | | 3924c65e-50d9-4bb9-9d67-e0c17a0f517f | | 0609d3b3b398456187fb705ec9224c4a | ACTIVE | 192.168.100.46 | 80 | NO_MONITOR | 1 | +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ # create a floating IP on public network [root@dlp ~(keystone)]# openstack floating ip create public +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | created_at | 2022-06-02T00:51:12Z | | description | | | dns_domain | | | dns_name | | | fixed_ip_address | None | | floating_ip_address | 10.0.0.249 | | floating_network_id | 0c96d581-95f3-4e72-9626-d0a94407d0ec | | id | fd2878aa-cf4c-4acc-b1bf-fe2a29379ddb | | name | 10.0.0.249 | | port_details | None | | port_id | None | | project_id | 0609d3b3b398456187fb705ec9224c4a | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2022-06-02T00:51:12Z | +---------------------+--------------------------------------+ # assosiate floating IP with VIP of loadbalancer instace [root@dlp ~(keystone)]# VIPPORT=$(openstack loadbalancer show lb01 | grep vip_port_id | awk {'print $4'}) [root@dlp ~(keystone)]# openstack floating ip set --port $VIPPORT 10.0.0.249
# verify settings to access to the floating IP [root@dlp ~(keystone)]# curl 10.0.0.249 Web Server on Instance01 [root@dlp ~(keystone)]# curl 10.0.0.249 Web Server on Instance02 [root@dlp ~(keystone)]# curl 10.0.0.249 Web Server on Instance01 [root@dlp ~(keystone)]# curl 10.0.0.249 Web Server on Instance02 |
Sponsored Link |
|