Ubuntu 20.04
Sponsored Link

OpenStack Yoga : Create LoadBalancer Image2022/04/12

 
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 |
+--------------------------------------+------------+--------+
| 23b9bc9a-174e-4afe-a068-c6bce4794894 | Amphora    | active |
| 53f6415a-1f98-485f-be0b-3f80edf523df | 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                              |
+--------------------------------------+---------+--------------------------------------+
| 8fd7472d-9182-4a17-aa35-984fb7fb059d | public  | 99f81758-a8a8-4a25-8c20-a8c52f374815 |
| b19c6ee5-26f7-4a98-8a8c-58a2e7637610 | private | 5d1edead-636e-4622-942a-bfd2347908e3 |
+--------------------------------------+---------+--------------------------------------+

root@network:~#
openstack security group list

+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| ID                                   | Name              | Description            | Project                          | Tags |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| 7700ae88-1d7c-42ab-86b2-6a2fbb131fa0 | lb-mgmt-sec-group | lb-mgmt-sec-group      | c043fb355eff47e69642adfcd7a55620 | []   |
| b6ea27c2-5847-45a3-802e-5e537bf938a5 | default           | Default security group | ddb7c08ba73a48eea040270d13a7b0cf | []   |
| ce206948-825f-49ce-8388-3f96de3f78ab | secgroup01        | secgroup01             | d3434f55aa5541cfab5f13916da0697d | []   |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+

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 = 7700ae88-1d7c-42ab-86b2-6a2fbb131fa0
# specify network ID to boot Amphora instance (example below specifies public network [public])
amp_boot_network_list = 8fd7472d-9182-4a17-aa35-984fb7fb059d
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