Ubuntu 20.04
Sponsored Link

OpenStack Wallaby : Create LoadBalancer Image2021/04/21

 
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
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |      Open vSwitch     |   |        Libvirt        |
|  Memcached  httpd     |   |     Neutron Server    |   |     Nova Compute      |
|  Keystone   Glance    |   |       OVN-Northd      |   |      Open vSwitch     |
|  Nova API             |   |     Cinder Volume     |   |   OVN Metadata Agent  |
|  Cinder API           |   |    Octavia Services   |   |     OVN-Controller    |
+-----------------------+   +-----------------------+   +-----------------------+

[1] Create a LoadBalancer Image and add it to Glance. It's OK to work on any node. (example below is on Control Node)
# create an instance image

root@dlp ~(keystone)#
snap install octavia-diskimage-retrofit --beta --devmode

root@dlp ~(keystone)#
cd /var/snap/octavia-diskimage-retrofit/common/tmp

root@dlp tmp(keystone)#
wget https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img

root@dlp tmp(keystone)#
octavia-diskimage-retrofit ubuntu-20.04-minimal-cloudimg-amd64.img ubuntu-amphora-haproxy-amd64.qcow2
# add to Glance

root@dlp ~(keystone)#
openstack image create "Amphora" --tag "Amphora" --file ubuntu-amphora-haproxy-amd64.qcow2 --disk-format qcow2 --container-format bare --private --project service
# add [flavor] for Amphora instance

root@dlp ~(keystone)#
openstack flavor create --id 100 --vcpus 1 --ram 1024 --disk 5 m1.octavia --private --project service
# add a security group for Amphora instance

root@dlp ~(keystone)#
openstack security group create lb-mgmt-sec-group --project service
# allow required ports for security group

root@dlp ~(keystone)#
openstack security group rule create --protocol icmp --ingress lb-mgmt-sec-group

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 22:22 lb-mgmt-sec-group

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 80:80 lb-mgmt-sec-group

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 443:443 lb-mgmt-sec-group

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 9443:9443 lb-mgmt-sec-group

[2] Configure Octavia service to set instance ID or security group ID.
root@network:~#
openstack image list

+--------------------------------------+------------+--------+
| ID                                   | Name       | Status |
+--------------------------------------+------------+--------+
| b5e1a5f3-9a39-490c-8394-f7b4c9bf0afb | Amphora    | active |
| 8df08a02-7c19-465e-8862-53eb2319918d | Ubuntu2004 | active |
+--------------------------------------+------------+--------+

root@network:~#
openstack flavor list --all

+-----+------------+------+------+-----------+-------+-----------+
| ID  | Name       |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+-----+------------+------+------+-----------+-------+-----------+
| 0   | m1.small   | 2048 |   10 |         0 |     1 | True      |
| 100 | m1.octavia | 1024 |    5 |         0 |     1 | False     |
+-----+------------+------+------+-----------+-------+-----------+

root@network:~#
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| ca2c4289-f0e7-42dc-95d4-ea9507567541 | private | c11c200c-d463-4330-beaf-80ab87ead256 |
| ffa87ed8-7da9-488c-a7c8-09912ca2443a | public  | e8c73b2b-a6c7-4d97-8782-df4d841f84eb |
+--------------------------------------+---------+--------------------------------------+

root@network:~#
openstack security group list

+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| ID                                   | Name              | Description            | Project                          | Tags |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| 20c6381f-07e1-4b79-9385-641c13c3a776 | default           | Default security group | e256a7323fda468fb02e8f1975fce488 | []   |
| 41242586-e48d-428e-ab7b-4f2f7409b1a3 | lb-mgmt-sec-group | lb-mgmt-sec-group      | b1f2e1bdf6fb4e03bb30ef3b90764d3b | []   |
| e8d72cf7-666a-4590-a95c-767f44025e49 | secgroup01        | secgroup01             | e256a7323fda468fb02e8f1975fce488 | []   |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+

root@network:~#
vi /etc/octavia/octavia.conf
# add into [controller_worker] section

[controller_worker]
client_ca = /etc/octavia/certs/client_ca.cert.pem
amp_image_tag = Amphora
# specify [flavor] ID for Amphora instance
amp_flavor_id = 100
# specify security group ID Amphora instance
amp_secgroup_list = 41242586-e48d-428e-ab7b-4f2f7409b1a3
# specify network ID to boot Amphora instance (example below specifies public network [public])
amp_boot_network_list = ffa87ed8-7da9-488c-a7c8-09912ca2443a
network_driver = allowed_address_pairs_driver
compute_driver = compute_nova_driver
amphora_driver = amphora_haproxy_rest_driver 

root@network:~#
systemctl restart octavia-api \
octavia-health-manager \
octavia-housekeeping \
octavia-worker

Matched Content