OpenStack Victoria : How to use Octavia2020/10/20 |
Install and Configure OpenStack Load Balancing as a Service (Octavia).
This example is based on the environment like follows.
Configured Networking is VXLAN like here on this environment. ------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | L2 Agent | | Libvirt | | Memcached httpd | | L3 Agent | | Nova Compute | | Keystone Glance | | Metadata Agent | | L2 Agent | | Nova API | | Octavia Services | | | | Neutron Server | | | | | | Metadata Agent | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | Create 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 | +--------------------------------------+----------------+--------------------------------------+------------------+ | 7aa5fca7-efe4-4a30-b1f0-0653cc743a1c | public-subnet | 5d7b1b73-602d-40e2-a82f-352991de37e0 | 10.0.0.0/24 | | e7e82cb2-29c0-4eea-a459-e212a2bc3650 | private-subnet | 9f39959f-2f70-400c-aa80-5de54e92cf27 | 192.168.100.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 | 2020-10-20T03:24:40 | | description | | | flavor_id | None | | id | a470fa59-3a14-4eef-9a55-b9783f4c9d04 | | listeners | | | name | lb01 | | operating_status | OFFLINE | | pools | | | project_id | b573c9e160864f028fc2d681a929f5af | | provider | amphora | | provisioning_status | PENDING_CREATE | | updated_at | None | | vip_address | 192.168.100.31 | | vip_network_id | 9f39959f-2f70-400c-aa80-5de54e92cf27 | | vip_port_id | 982e19d5-0ad5-4323-8a6c-40b9ab782bdf | | vip_qos_policy_id | None | | vip_subnet_id | e7e82cb2-29c0-4eea-a459-e212a2bc3650 | +---------------------+--------------------------------------+ # 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 | +--------------------------------------+------+----------------------------------+----------------+---------------------+------------------+----------+ | a470fa59-3a14-4eef-9a55-b9783f4c9d04 | lb01 | b573c9e160864f028fc2d681a929f5af | 192.168.100.31 | 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 | 2020-10-20T03:31:53 | | default_pool_id | None | | default_tls_container_ref | None | | description | | | id | 1805953e-5c0d-424e-a0d3-b9cd450769d4 | | insert_headers | None | | l7policies | | | loadbalancers | a470fa59-3a14-4eef-9a55-b9783f4c9d04 | | name | listener01 | | operating_status | OFFLINE | | project_id | b573c9e160864f028fc2d681a929f5af | | 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 | +-----------------------------+--------------------------------------+ # 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 | 2020-10-20T03:32:11 | | description | | | healthmonitor_id | | | id | 7b0139c5-dffe-4969-8f0d-c9a092ea734f | | lb_algorithm | ROUND_ROBIN | | listeners | 1805953e-5c0d-424e-a0d3-b9cd450769d4 | | loadbalancers | a470fa59-3a14-4eef-9a55-b9783f4c9d04 | | members | | | name | pool01 | | operating_status | OFFLINE | | project_id | b573c9e160864f028fc2d681a929f5af | | 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 | +----------------------+--------------------------------------+ # web server instances root@dlp ~(keystone)# openstack server list +--------------------------------------+-------------------+--------+-------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------------+--------+-------------------------+------------+----------+ | 79cd409d-05b6-4734-b395-656f91b3e365 | Ubuntu_2004-web02 | ACTIVE | private=192.168.100.13 | Ubuntu2004 | m1.small | | 112e5147-2405-4cb6-81ad-e813fcc8ec85 | Ubuntu_2004-web01 | ACTIVE | private=192.168.100.189 | Ubuntu2004 | 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.13 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.13 | | admin_state_up | True | | created_at | 2020-10-20T03:33:56 | | id | 9dff05b5-5332-4406-994e-4acf20c3c36e | | name | | | operating_status | NO_MONITOR | | project_id | b573c9e160864f028fc2d681a929f5af | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | e7e82cb2-29c0-4eea-a459-e212a2bc3650 | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | +---------------------+--------------------------------------+root@dlp ~(keystone)# openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.189 --protocol-port 80 pool01 +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | address | 192.168.100.189 | | admin_state_up | True | | created_at | 2020-10-20T03:34:12 | | id | d7d3d421-bb7e-492d-a913-a39785abaedd | | name | | | operating_status | NO_MONITOR | | project_id | b573c9e160864f028fc2d681a929f5af | | protocol_port | 80 | | provisioning_status | PENDING_CREATE | | subnet_id | e7e82cb2-29c0-4eea-a459-e212a2bc3650 | | updated_at | None | | weight | 1 | | monitor_port | None | | monitor_address | None | | backup | False | +---------------------+--------------------------------------+root@dlp ~(keystone)# openstack loadbalancer member list pool01 +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ | id | name | project_id | provisioning_status | address | protocol_port | operating_status | weight | +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ | 9dff05b5-5332-4406-994e-4acf20c3c36e | | b573c9e160864f028fc2d681a929f5af | ACTIVE | 192.168.100.13 | 80 | NO_MONITOR | 1 | | d7d3d421-bb7e-492d-a913-a39785abaedd | | b573c9e160864f028fc2d681a929f5af | ACTIVE | 192.168.100.189 | 80 | NO_MONITOR | 1 | +--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+ # create a floating IP on public network root@dlp ~(keystone)# openstack floating ip create public +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | created_at | 2020-10-20T03:34:52Z | | description | | | dns_domain | None | | dns_name | None | | fixed_ip_address | None | | floating_ip_address | 10.0.0.249 | | floating_network_id | 5d7b1b73-602d-40e2-a82f-352991de37e0 | | id | c7b841f6-a2e8-4b1a-afdb-baf8d42e7b7c | | name | 10.0.0.249 | | port_details | None | | port_id | None | | project_id | b573c9e160864f028fc2d681a929f5af | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2020-10-20T03:34:52Z | +---------------------+--------------------------------------+ # 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 |