Ubuntu 22.04
Sponsored Link

OpenStack Antelope : Create LoadBalancer Image2023/03/28

 
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] 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 |
+--------------------------------------+------------+--------+
| 1fca3714-84c1-42b5-b582-b9704258b295 | Amphora    | active |
| 00ea6e97-0e97-4cb4-8ac4-2409c28f0289 | Ubuntu2204 | active |
+--------------------------------------+------------+--------+

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

+-----+------------+------+------+-----------+-------+-----------+
| ID  | Name       |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+-----+------------+------+------+-----------+-------+-----------+
| 1   | m1.small   | 2048 |   10 |         0 |     1 | True      |
| 100 | m1.octavia | 2048 |    5 |         0 |     1 | False     |
| 2   | m1.medium  | 4096 |   10 |         0 |     2 | True      |
| 3   | m1.large   | 8192 |   20 |        10 |     4 | True      |
+-----+------------+------+------+-----------+-------+-----------+

root@network:~#
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 5352e6c0-47b3-4df2-84f4-ca048f141e1d | public  | ca5539a8-0291-4684-9fb3-0f448efacebf |
| ce6e88bc-107a-446b-b2ab-255bab7269fe | private | feb337ec-215e-406e-8871-196fed2c4207 |
+--------------------------------------+---------+--------------------------------------+

root@network:~#
openstack security group list

+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| ID                                   | Name              | Description            | Project                          | Tags |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| 00fec817-6562-4ab5-8f45-0bc4954f6d00 | secgroup01        | secgroup01             | e294bd7c00314facacdb46c36fb54ee9 | []   |
| a2ddd3fa-c8a1-4583-b473-b2aff2d572c5 | lb-mgmt-sec-group | lb-mgmt-sec-group      | d3dd87fb1a034f7883539a6a4f83781f | []   |
| a98a016e-afcc-4bbb-9f24-0902572f98ee | default           | Default security group | cac657ec003e4c95aaaa30bc0321895f | []   |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+

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 for Amphora instance
amp_secgroup_list = a2ddd3fa-c8a1-4583-b473-b2aff2d572c5
# specify network ID to boot Amphora instance (example below specifies public network [public])
amp_boot_network_list = 5352e6c0-47b3-4df2-84f4-ca048f141e1d
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