My scenario:
Openstack enviornment is configured on 3 nodes with CentOS 7 & OpenStack Juno.
srv1 -> Controller node, Compute, Neutron Server, Cinder
srv2-> Compute Node
srv3-> Neutron Network Node, Compute Node
Virtual Architecture of Load Balancer as a Service (lbaas) :
Steps:
1. Install haproxy on all nodes as it is used as loadbalancer in our example.
2. Enable HAProxy plugin on all nodes
In /etc/neutron/neutron.conf file search for “service_provider” and please uncomment below line
service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
Add lbaas to “service_plugins”
service_plugins = router,lbaas
In /etc/neutron/lbaas_agent.ini file uncomment below line if you are using OVS:
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
Also uncomment below line in same file:
device_driver = neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
3. Enable load balancing in openstack dashboard on Controller node
In /etc/openstack-dashboard/local_settings file just make sure for enable_lb=true
OPENSTACK_NEUTRON_NETWORK = {
….
‘enable_lb’: True,
4. Restart neutron.server and start neutron-lbaas-agent on Network node
On Network Node:
systemctl enable neutron-lbaas-agent.service
systemctl start neutron-lbaas-agent.service
On Controller Node:
systemctl restart neutron-server.service
systemctl restart httpd.service
Now you will be able to see “Load Balancers” on OpenStack Dashboard webpage under Project -> Network Menu
5. Commands to configure LB for 2 VM instances:
Get the details of running Instances
nova list
I have 2 Instances Running HTTPD server on Server1 & Server2
VM Name -> VM ID -> Private Network IP
Server1 -> 94e513c1-8cd2-436d-9895-d806a18b2e99 -> 172.16.0.52
Server2-> de3c6b45-89aa-4273-8145-deb45079908b -> 172.16.0.53
Get network details
neutron net-list
I have 2 Networks:
1. InternalNet
2. ext-net
Get the subnet details
neutron subnet-list
I have 2 subnets:
Internal 172.16.0.0/24 –> 688f4cf8-27b9-46c0-aa44-a1b7ab9a9d7a
ext-subnet 192.168.2.0/24 –> 39d745e9-8e92-410b-b6e3-a69744c6c89e
Create Pool:
neutron lb-pool-create –name http-pool –lb-method ROUND_ROBIN –protocol HTTP –subnet-id 688f4cf8-27b9-46c0-aa44-a1b7ab9a9d7a
neutron lb-pool-list
89f96608-c47e-4aa4-a639-0d1a74d4b043 | http-pool | haproxy | ROUND_ROBIN | HTTP | True | ACTIVE
It will show the list pool created. It should show “ACTIVE” at the end.
Get the details of Pool:
neutron lb-pool-show http-pool
Add Members to pool:
neutron lb-member-create –address 172.16.0.52 –protocol-port 80 http-pool
neutron lb-member-create –address 172.16.0.53 –protocol-port 80 http-pool
Confirm the members are added and ACTIVE:
neutron lb-member-list –sort-key address –sort-dir asc
Confirm Individually with their Member IDs
neutron lb-member-show 98589e28-31ae-4c8a-87ad-6c700c05130f
neutron lb-member-show d430f404-081e-40fa-a74c-5eef8162dcf7
Create Health Monitor:
neutron lb-healthmonitor-create –delay 3 –type HTTP –max-retries 3 –timeout 3
Confirm Health Monitor is created and get details:
neutron lb-healthmonitor-list
Health Monitor ID is 2d843dd4-9e0f-4c5e-bde8-e40ea247f4b7
Associate Health Monitor to Pool:
neutron lb-healthmonitor-associate 2d843dd4-9e0f-4c5e-bde8-e40ea247f4b7 http-pool
Create Virtual IP with HTTP port to Pool:
neutron lb-vip-create –name http-vip –protocol-port 80 –protocol HTTP –subnet-id 688f4cf8-27b9-46c0-aa44-a1b7ab9a9d7a http-pool
Confirm VIP is created with ACTIVE status:
neutron lb-vip-list
Here you may find Status “ERROR” if you are running Openstack JUNO on CentOS 7.
Check /var/log/neutron/lbaas-agent.log on Network Node. You may see below errors:
parsing [/var/lib/neutron/lbaas/89f96608-c47e-4aa4-a639-0d1a74d4b043/conf:4] : cannot find group id for ‘nogroup’ (0:Success)n[ALERT] 315/143212 (6522) : Error(s) found in configuration file :
Please add nogroup manually on network node.
groupadd nogroup
Associate Floating IP to VIP
Create Floating IP:
neutron floatingip-create ext-net
Get the Port ID of VIP:
neutron lb-vip-show <id of vip>
neutron lb-vip-show 19626294-6c2e-41a5-a390-81333e2eeb91
Associate the Floating IP to Port ID of VIP:
neutron floatingip-associate 25268f99-073e-4296-a633-3b2aab5e9fa0 e7403711-a44f-4ed4-b3ae-e6c31db335a9
Get the Floating IP Lists to verify:
neutron floatingip-list –sort-key floating_ip_address –sort-dir asc
Now check in browser http://<associated_floating_ip/