blob: 3592844efb7dfe493a8ce222e0d80208a334975f [file] [log] [blame]
Richard Theis7e550682015-10-13 07:51:05 -05001Configure Load-Balancer Version 2
Aishwarya Thangappa7c573062015-02-18 01:51:13 -08002=================================
3
Richard Theis7e550682015-10-13 07:51:05 -05004Starting in the OpenStack Liberty release, the
5`neutron LBaaS v2 API <http://developer.openstack.org/api-ref-networking-v2-ext.html>`_
6is now stable while the LBaaS v1 API has been deprecated. The LBaaS v2 reference
7driver is based on Octavia.
Aishwarya Thangappa7c573062015-02-18 01:51:13 -08008
9
10Phase 1: Create DevStack + 2 nova instances
11--------------------------------------------
12
Richard Theis7e550682015-10-13 07:51:05 -050013First, set up a vm of your choice with at least 8 GB RAM and 16 GB disk space,
14make sure it is updated. Install git and any other developer tools you find useful.
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080015
16Install devstack
17
18 ::
19
20 git clone https://git.openstack.org/openstack-dev/devstack
21 cd devstack
22
23
Markus Zoellerc30657d2015-11-02 11:27:46 +010024Edit your ``local.conf`` to look like
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080025
26 ::
27
28 [[local|localrc]]
29 # Load the external LBaaS plugin.
30 enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas
Richard Theis7e550682015-10-13 07:51:05 -050031 enable_plugin octavia https://git.openstack.org/openstack/octavia
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080032
33 # ===== BEGIN localrc =====
34 DATABASE_PASSWORD=password
35 ADMIN_PASSWORD=password
36 SERVICE_PASSWORD=password
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080037 RABBIT_PASSWORD=password
38 # Enable Logging
39 LOGFILE=$DEST/logs/stack.sh.log
40 VERBOSE=True
41 LOG_COLOR=True
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080042 # Pre-requisite
43 ENABLED_SERVICES=rabbit,mysql,key
44 # Horizon
45 ENABLED_SERVICES+=,horizon
46 # Nova
Nir Magneziac2ae8c2017-05-22 12:40:57 +030047 ENABLED_SERVICES+=,n-api,n-cpu,n-cond,n-sch
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080048 # Glance
49 ENABLED_SERVICES+=,g-api,g-reg
50 # Neutron
51 ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta
Richard Theis7e550682015-10-13 07:51:05 -050052 # Enable LBaaS v2
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080053 ENABLED_SERVICES+=,q-lbaasv2
Richard Theis7e550682015-10-13 07:51:05 -050054 ENABLED_SERVICES+=,octavia,o-cw,o-hk,o-hm,o-api
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080055 # Cinder
56 ENABLED_SERVICES+=,c-api,c-vol,c-sch
57 # Tempest
58 ENABLED_SERVICES+=,tempest
59 # ===== END localrc =====
60
61Run stack.sh and do some sanity checks
62
63 ::
64
65 ./stack.sh
66 . ./openrc
67
Armando Migliaccio4f11ff32016-10-27 06:15:23 -070068 openstack network list # should show public and private networks
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080069
70Create two nova instances that we can use as test http servers:
71
72 ::
73
74 #create nova instances on private network
Armando Migliaccio4f11ff32016-10-27 06:15:23 -070075 nova boot --image $(nova image-list | awk '/ cirros-.*-x86_64-uec / {print $2}') --flavor 1 --nic net-id=$(openstack network list | awk '/ private / {print $2}') node1
76 nova boot --image $(nova image-list | awk '/ cirros-.*-x86_64-uec / {print $2}') --flavor 1 --nic net-id=$(openstack network list | awk '/ private / {print $2}') node2
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080077 nova list # should show the nova instances just created
78
Richard Theis7e550682015-10-13 07:51:05 -050079 #add secgroup rules to allow ssh etc..
Armando Migliaccio4f11ff32016-10-27 06:15:23 -070080 openstack security group rule create default --protocol icmp
81 openstack security group rule create default --protocol tcp --dst-port 22:22
82 openstack security group rule create default --protocol tcp --dst-port 80:80
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080083
84Set up a simple web server on each of these instances. ssh into each instance (username 'cirros', password 'cubswin:)') and run
85
86 ::
87
88 MYIP=$(ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}')
89 while true; do echo -e "HTTP/1.0 200 OK\r\n\r\nWelcome to $MYIP" | sudo nc -l -p 80 ; done&
90
91Phase 2: Create your load balancers
92------------------------------------
93
94 ::
95
96 neutron lbaas-loadbalancer-create --name lb1 private-subnet
Richard Theis7e550682015-10-13 07:51:05 -050097 neutron lbaas-loadbalancer-show lb1 # Wait for the provisioning_status to be ACTIVE.
Aishwarya Thangappa7c573062015-02-18 01:51:13 -080098 neutron lbaas-listener-create --loadbalancer lb1 --protocol HTTP --protocol-port 80 --name listener1
Richard Theis7e550682015-10-13 07:51:05 -050099 sleep 10 # Sleep since LBaaS actions can take a few seconds depending on the environment.
Aishwarya Thangappa7c573062015-02-18 01:51:13 -0800100 neutron lbaas-pool-create --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP --name pool1
Richard Theis7e550682015-10-13 07:51:05 -0500101 sleep 10
Aishwarya Thangappa7c573062015-02-18 01:51:13 -0800102 neutron lbaas-member-create --subnet private-subnet --address 10.0.0.3 --protocol-port 80 pool1
Richard Theis7e550682015-10-13 07:51:05 -0500103 sleep 10
Aishwarya Thangappa7c573062015-02-18 01:51:13 -0800104 neutron lbaas-member-create --subnet private-subnet --address 10.0.0.5 --protocol-port 80 pool1
105
Richard Theis7e550682015-10-13 07:51:05 -0500106Please note here that the "10.0.0.3" and "10.0.0.5" in the above commands are the IPs of the nodes
107(in my test run-thru, they were actually 10.2 and 10.4), and the address of the created LB will be
108reported as "vip_address" from the lbaas-loadbalancer-create, and a quick test of that LB is
109"curl that-lb-ip", which should alternate between showing the IPs of the two nodes.