OpenStack Ussuri : Create LoadBalancer Image2020/06/16 |
Install and Configure OpenStack Load Balancing as a Service (Octavia).
This example is based on the environment like follows.
Configured Networking is VXLAN like here on this environment. ------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | L2 Agent | | Libvirt | | Memcached httpd | | L3 Agent | | Nova Compute | | Keystone Glance | | Metadata Agent | | L2 Agent | | Nova API | | Octavia Services | | | | Neutron Server | | | | | | Metadata Agent | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[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/bionic/release/ubuntu-18.04-minimal-cloudimg-amd64.img root@dlp tmp(keystone)# octavia-diskimage-retrofit ubuntu-18.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 | +--------------------------------------+------------+--------+ | 9fda51a3-7a42-4d2d-a8e7-06ef66e3cba8 | Amphora | active | | de51f2d9-aa58-4a34-87d6-857451599d9a | 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 | +--------------------------------------+---------+--------------------------------------+ | 1f3f1f9b-4822-4312-b5a5-51a529cd6e8a | ext_net | ddfcdd10-7ecb-4239-b3d7-46fdd15a006d | | b351e1b9-bd7c-4e3c-b5eb-848d211f4392 | int_net | e2a461fc-9d50-4bab-913f-14067b175ea6 | +--------------------------------------+---------+--------------------------------------+root@network:~# openstack security group list +--------------------------------------+-------------------+------------------------+----------------------------------+------+ | ID | Name | Description | Project | Tags | +--------------------------------------+-------------------+------------------------+----------------------------------+------+ | 501ec49f-16e4-4ce2-b781-28ce4f9ee811 | default | Default security group | 3227cdd34d5c4d9c97eeb8f0dfdf5d0e | [] | | 58e82471-c4e8-4505-9382-405e065fead4 | secgroup01 | secgroup01 | eaa8de359ae0451d944a6401e688f730 | [] | | 7708c82b-2ae9-4f34-9fce-28b9995288e0 | lb-mgmt-sec-group | lb-mgmt-sec-group | c0e098a54a4640caa9004fb8f500f554 | [] | +--------------------------------------+-------------------+------------------------+----------------------------------+------+
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 = 7708c82b-2ae9-4f34-9fce-28b9995288e0
# specify network ID to boot Amphora instance (example below specifies public network [ext_net])
amp_boot_network_list = 1f3f1f9b-4822-4312-b5a5-51a529cd6e8a
network_driver = allowed_address_pairs_driver
compute_driver = compute_nova_driver
amphora_driver = amphora_haproxy_rest_driver
root@network:~# |
Sponsored Link |