Debian 12 bookworm
Sponsored Link

OpenStack Zed : Create LoadBalancer Image2023/06/30

 
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  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |                       |
|  Neutron Metadata     |  |    Octavia Services   |  |                       |
|  Cinder API           |  |        Nginx          |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1]
[2] 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 --edge --classic

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 10 m1.octavia --private --project service
root@dlp ~(keystone)#
vi /etc/neutron/policy.d/00_default_policy.yaml
# line 2274 : add

"create_security_group": "(rule:admin_only) or (role:member and project_id:%(project_id)s)"
# line 2286 : add

"get_security_group": "(rule:admin_only) or (role:reader and project_id:%(project_id)s)"
root@dlp ~(keystone)#
systemctl restart neutron-api
# 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

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

+--------------------------------------+----------+--------+
| ID                                   | Name     | Status |
+--------------------------------------+----------+--------+
| 7efb3209-163c-4db8-a689-5fd97294393f | Amphora  | active |
| 3a660af6-3f41-4c0f-b2a8-55127dfc3c60 | Debian12 | 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 | 1024 |   10 |         0 |     1 | False     |
| 2   | m1.medium  | 4096 |   10 |         0 |     2 | True      |
| 3   | m1.large   | 8192 |   10 |         0 |     4 | True      |
| 4   | m2.large   | 8192 |   10 |        10 |     4 | True      |
| 5   | m3.large   | 8192 |   20 |         0 |     4 | True      |
+-----+------------+------+------+-----------+-------+-----------+

root@network:~#
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| ae5fdb1f-efb9-412b-9053-b81106c90336 | private | b3234f3f-b3e3-41d2-b3a4-ca3d4ec55d24 |
| b9b8536b-0696-4a5b-af05-602587435c0a | public  | 0129c597-e411-450e-a4f9-b387c68eddb3 |
+--------------------------------------+---------+--------------------------------------+

root@network:~#
openstack security group list

+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| ID                                   | Name              | Description            | Project                          | Tags |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+
| 57494e22-5023-4ff4-b09d-d71f9b9d96ae | default           | Default security group | d8b09d86ed7743039f92b2e542ea26c1 | []   |
| 5b01bb91-a6a0-4516-81bd-7af66f087ee2 | lb-mgmt-sec-group | lb-mgmt-sec-group      | d8b09d86ed7743039f92b2e542ea26c1 | []   |
| bd1040a7-caab-477e-a1bb-add49bb8f16a | secgroup01        | secgroup01             | 1c2f5dc8c4f9494fbaaa4217c8e3585a | []   |
+--------------------------------------+-------------------+------------------------+----------------------------------+------+

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 = 5b01bb91-a6a0-4516-81bd-7af66f087ee2
# specify network ID to boot Amphora instance (example below specifies public network [public])
amp_boot_network_list = b9b8536b-0696-4a5b-af05-602587435c0a
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

[4] On all Compute Node, Install required packages.
root@node01:~#
apt -y install genisoimage
Matched Content