CentOS Stream 8
Sponsored Link

OpenStack Yoga : Create LoadBalancer Image
2022/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 Image and add it to Glance.
It's OK to work on any node. (example below is on Control Node)
# install from Yoga, EPEL, PowerTools

[root@dlp ~(keystone)]#
dnf --enablerepo=centos-openstack-yoga,powertools,epel -y install openstack-octavia-diskimage-create debootstrap python3-octaviaclient
# create an instance image

[root@dlp ~(keystone)]#
octavia-diskimage-create.sh -d focal
# add to Glance

[root@dlp ~(keystone)]#
openstack image create "Amphora" --tag "Amphora" --file amphora-x64-haproxy.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 |
+--------------------------------------+-----------------+--------+
| 81e2bcae-8be2-4008-9df7-bdf022d75a4c | Amphora         | active |
| 7be5b7ab-36e8-43c7-95dd-34b4139a0e44 | CentOS-Stream-8 | 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                              |
+--------------------------------------+---------+--------------------------------------+
| 0c96d581-95f3-4e72-9626-d0a94407d0ec | public  | e20328ce-a24a-4804-be39-88f18800526f |
| 0f0af4c7-f2d1-4c13-b30c-4619ff33db0c | private | 748c0a25-c6d8-48fd-829e-8b15783b7f8a |
+--------------------------------------+---------+--------------------------------------+

[root@network ~]#
openstack security group list

+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| ID                                   | Name              | Description            | Project                          | Tags |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| 1cf20194-28dd-4256-b1a2-8abc3b537c11 | lb-mgmt-sec-group | lb-mgmt-sec-group      | 8787527217494c6a87dd5a3b68dce1ef | []   |
| 78a872a1-e325-4a8d-b9a2-1ef6661a354c | secgroup01        | secgroup01             | 3d85d1e79d654b3dade01eb5bfbf0679 | []   |
| af3c2eee-b1cc-4103-8c14-4f9bf7018297 | default           | Default security group | 0609d3b3b398456187fb705ec9224c4a | []   |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+

[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 = 1cf20194-28dd-4256-b1a2-8abc3b537c11
# specify network ID to boot Amphora instance (example below specifies public network [public])
amp_boot_network_list = 0c96d581-95f3-4e72-9626-d0a94407d0ec
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