This document explains the steps to configure Load-Balancer in
kilo.
Change-Id: Ic8c2f3cca80e331b7275f689051c07d863d918ea
Depends-On: I64a94aeeabe6357b5ea7796e34c9306c55c9ae67
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,99 @@ |
0 |
+Configure Load-Balancer in Kilo |
|
1 |
+================================= |
|
2 |
+ |
|
3 |
+The Kilo release of OpenStack will support Version 2 of the neutron load balancer. Until now, using OpenStack `LBaaS V2 <http://docs.openstack.org/api/openstack-network/2.0/content/lbaas_ext.html>`_ has required a good understanding of neutron and LBaaS architecture and several manual steps. |
|
4 |
+ |
|
5 |
+ |
|
6 |
+Phase 1: Create DevStack + 2 nova instances |
|
7 |
+-------------------------------------------- |
|
8 |
+ |
|
9 |
+First, set up a vm of your choice with at least 8 GB RAM and 16 GB disk space, make sure it is updated. Install git and any other developer tools you find useful. |
|
10 |
+ |
|
11 |
+Install devstack |
|
12 |
+ |
|
13 |
+ :: |
|
14 |
+ |
|
15 |
+ git clone https://git.openstack.org/openstack-dev/devstack |
|
16 |
+ cd devstack |
|
17 |
+ |
|
18 |
+ |
|
19 |
+Edit your `local.conf` to look like |
|
20 |
+ |
|
21 |
+ :: |
|
22 |
+ |
|
23 |
+ [[local|localrc]] |
|
24 |
+ # Load the external LBaaS plugin. |
|
25 |
+ enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas |
|
26 |
+ |
|
27 |
+ # ===== BEGIN localrc ===== |
|
28 |
+ DATABASE_PASSWORD=password |
|
29 |
+ ADMIN_PASSWORD=password |
|
30 |
+ SERVICE_PASSWORD=password |
|
31 |
+ SERVICE_TOKEN=password |
|
32 |
+ RABBIT_PASSWORD=password |
|
33 |
+ # Enable Logging |
|
34 |
+ LOGFILE=$DEST/logs/stack.sh.log |
|
35 |
+ VERBOSE=True |
|
36 |
+ LOG_COLOR=True |
|
37 |
+ SCREEN_LOGDIR=$DEST/logs |
|
38 |
+ # Pre-requisite |
|
39 |
+ ENABLED_SERVICES=rabbit,mysql,key |
|
40 |
+ # Horizon |
|
41 |
+ ENABLED_SERVICES+=,horizon |
|
42 |
+ # Nova |
|
43 |
+ ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch |
|
44 |
+ IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" |
|
45 |
+ # Glance |
|
46 |
+ ENABLED_SERVICES+=,g-api,g-reg |
|
47 |
+ # Neutron |
|
48 |
+ ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta |
|
49 |
+ # Enable LBaaS V2 |
|
50 |
+ ENABLED_SERVICES+=,q-lbaasv2 |
|
51 |
+ # Cinder |
|
52 |
+ ENABLED_SERVICES+=,c-api,c-vol,c-sch |
|
53 |
+ # Tempest |
|
54 |
+ ENABLED_SERVICES+=,tempest |
|
55 |
+ # ===== END localrc ===== |
|
56 |
+ |
|
57 |
+Run stack.sh and do some sanity checks |
|
58 |
+ |
|
59 |
+ :: |
|
60 |
+ |
|
61 |
+ ./stack.sh |
|
62 |
+ . ./openrc |
|
63 |
+ |
|
64 |
+ neutron net-list # should show public and private networks |
|
65 |
+ |
|
66 |
+Create two nova instances that we can use as test http servers: |
|
67 |
+ |
|
68 |
+ :: |
|
69 |
+ |
|
70 |
+ #create nova instances on private network |
|
71 |
+ nova boot --image $(nova image-list | awk '/ cirros-0.3.0-x86_64-disk / {print $2}') --flavor 1 --nic net-id=$(neutron net-list | awk '/ private / {print $2}') node1 |
|
72 |
+ nova boot --image $(nova image-list | awk '/ cirros-0.3.0-x86_64-disk / {print $2}') --flavor 1 --nic net-id=$(neutron net-list | awk '/ private / {print $2}') node2 |
|
73 |
+ nova list # should show the nova instances just created |
|
74 |
+ |
|
75 |
+ #add secgroup rule to allow ssh etc.. |
|
76 |
+ neutron security-group-rule-create default --protocol icmp |
|
77 |
+ neutron security-group-rule-create default --protocol tcp --port-range-min 22 --port-range-max 22 |
|
78 |
+ neutron security-group-rule-create default --protocol tcp --port-range-min 80 --port-range-max 80 |
|
79 |
+ |
|
80 |
+Set up a simple web server on each of these instances. ssh into each instance (username 'cirros', password 'cubswin:)') and run |
|
81 |
+ |
|
82 |
+ :: |
|
83 |
+ |
|
84 |
+ MYIP=$(ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}') |
|
85 |
+ while true; do echo -e "HTTP/1.0 200 OK\r\n\r\nWelcome to $MYIP" | sudo nc -l -p 80 ; done& |
|
86 |
+ |
|
87 |
+Phase 2: Create your load balancers |
|
88 |
+------------------------------------ |
|
89 |
+ |
|
90 |
+ :: |
|
91 |
+ |
|
92 |
+ neutron lbaas-loadbalancer-create --name lb1 private-subnet |
|
93 |
+ neutron lbaas-listener-create --loadbalancer lb1 --protocol HTTP --protocol-port 80 --name listener1 |
|
94 |
+ neutron lbaas-pool-create --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP --name pool1 |
|
95 |
+ neutron lbaas-member-create --subnet private-subnet --address 10.0.0.3 --protocol-port 80 pool1 |
|
96 |
+ neutron lbaas-member-create --subnet private-subnet --address 10.0.0.5 --protocol-port 80 pool1 |
|
97 |
+ |
|
98 |
+Please note here that the "10.0.0.3" and "10.0.0.5" in the above commands are the IPs of the nodes (in my test run-thru, they were actually 10.2 and 10.4), and the address of the created LB will be reported as "vip_address" from the lbaas-loadbalancer-create, and a quick test of that LB is "curl that-lb-ip", which should alternate between showing the IPs of the two nodes. |