Assume you have already set up OpenStack multi nodes with kolla.
http://lost-and-found-narihiro.blogspot.jp/2017/09/deploy-openstack-multi-nodes-with-kolla.html
Destroy an existing environment.
# kolla-ansible destroy --yes-i-really-really-mean-it
|
edit globals.yml. enable lbaas.
# egrep lbaas /etc/kolla/globals.yml | grep -v ^#
enable_horizon_neutron_lbaas: "yes"
enable_neutron_lbaas: "yes"
|
deploy OpenStack.
# kolla-ansible deploy ./multimode
# kolla-ansible post-deploy
# ./usr/local/share/kolla-ansible/init-runonce
|
Launch two instances. ( OS is Ubuntu )
root@controller:~# openstack server list
+--------------------------------------+------------+--------+--------------------+--------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+------------+--------+--------------------+--------+----------+
| 8c5d5851-d1e2-44a7-9f3f-5dfbed6b4da6 | instance01 | ACTIVE | demo-net=10.0.0.13 | xenial | m1.small |
| 1aa40f22-180b-4d42-b0fa-72ad813288ab | instance02 | ACTIVE | demo-net=10.0.0.12 | xenial | m1.small |
+--------------------------------------+------------+--------+--------------------+--------+----------+
|
Create a load balancer via GUI
root@controller:~# source /etc/kolla/admin-openrc.sh
root@controller:~# neutron
(neutron) lbaas-loadbalancer-list
+--------------------------------------+------+-------------+---------------------+----------+
| id | name | vip_address | provisioning_status | provider |
+--------------------------------------+------+-------------+---------------------+----------+
| db08bd1b-9f22-4281-8439-1ae808b79e54 | lb01 | 10.0.0.4 | ACTIVE | haproxy |
+--------------------------------------+------+-------------+---------------------+----------+
(neutron) lbaas-pool-list
+--------------------------------------+--------+----------+----------------+
| id | name | protocol | admin_state_up |
+--------------------------------------+--------+----------+----------------+
| 6183cf5f-8efe-44c5-8cfb-5cae52f3de04 | Pool 1 | HTTP | True |
+--------------------------------------+--------+----------+----------------+
(neutron) lbaas-listener-list
+--------------------------------------+--------------------------------------+------------+----------+---------------+----------------+
| id | default_pool_id | name | protocol | protocol_port | admin_state_up |
+--------------------------------------+--------------------------------------+------------+----------+---------------+----------------+
| 270a57ce-3205-40fb-926f-201bb7d064ac | 6183cf5f-8efe-44c5-8cfb-5cae52f3de04 | Listener 1 | HTTP | 80 | True |
+--------------------------------------+--------------------------------------+------------+----------+---------------+----------------+
(neutron) lbaas-healthmonitor-list
+--------------------------------------+------+------+----------------+
| id | name | type | admin_state_up |
+--------------------------------------+------+------+----------------+
| 80567969-c3b8-45fa-89f8-ac969bb21449 | | HTTP | True |
+--------------------------------------+------+------+----------------+
(neutron)
|
add floating IPs for the LB.
Associate a floating IP with the LB.
run HTTP service on the two instances.
root@instance01:~# echo 'instance01' > /var/www/html/index.html
root@instance01:~# curl http://127.0.0.1
instance01
root@instance01:~#
root@instance02:~# echo 'instance02' > /var/www/html/index.html
root@instance02:~# curl http://127.0.0.1
instance02
|
Confirm you can get a reply from LB’s IP.
LB demo net IP : 10.0.0.4
LB floating IP : 192.168.100.123
root@controller:~# docker ps | grep l3
6fcf0ce0f41e 192.168.100.10:5000/kolla/ubuntu-source-neutron-l3-agent:4.0.2 "kolla_start" 2 hours ago Up 2 hours neutron_l3_agent
root@controller:~# docker exec -i -t -u root 6fcf0ce0f41e ip netns exec qrouter-315eb0f1-5d80-45f0-9d4c-bfba3e98b9c4 curl http://10.0.0.4
instance01
curl (http://10.0.0.4/): response: 200, time: 0.003, size: 11
root@controller:~# docker exec -i -t -u root 6fcf0ce0f41e ip netns exec qrouter-315eb0f1-5d80-45f0-9d4c-bfba3e98b9c4 curl http://10.0.0.4
instance02
curl (http://10.0.0.4/): response: 200, time: 0.002, size: 11
root@controller:~# docker exec -i -t -u root 6fcf0ce0f41e ip netns exec qrouter-315eb0f1-5d80-45f0-9d4c-bfba3e98b9c4 curl http://10.0.0.4
instance01
curl (http://10.0.0.4/): response: 200, time: 0.002, size: 11
root@controller:~#
|
via a LB’s floating IP.
$ curl http://192.168.100.123
instance02
$ curl http://192.168.100.123
instance01
$ curl http://192.168.100.123
instance02
|
stop apache on instance02.
ubuntu@instance02:~$ sudo systemctl stop apache2
|
access to the floating IP
$ curl http://192.168.100.123
instance01
$ curl http://192.168.100.123
instance01
$ curl http://192.168.100.123
instance01
|
Source IP address is NATed to LB’s IP
on the instance02.
root@instance02:~# tcpdump -nn -i ens3 port 80 | grep -i get
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
04:36:05.861461 IP 10.0.0.4.43086 > 10.0.0.12.80: Flags [P.], seq 1:38, ack 1, win 221, options [nop,nop,TS val 1987433 ecr 800265], length 37: HTTP: GET / HTTP/1.0
|
(neutron) lbaas-loadbalancer-list
+--------------------------------------+------+-------------+---------------------+----------+
| id | name | vip_address | provisioning_status | provider |
+--------------------------------------+------+-------------+---------------------+----------+
| db08bd1b-9f22-4281-8439-1ae808b79e54 | lb01 | 10.0.0.4 | ACTIVE | haproxy |
+--------------------------------------+------+-------------+---------------------+----------+
|
(neutron) lbaas-loadbalancer-stats db08bd1b-9f22-4281-8439-1ae808b79e54
+--------------------+-------+
| Field | Value |
+--------------------+-------+
| active_connections | 0 |
| bytes_in | 2558 |
| bytes_out | 7821 |
| total_connections | 33 |
+--------------------+-------+
(neutron) lbaas-loadbalancer-status db08bd1b-9f22-4281-8439-1ae808b79e54
{
"loadbalancer": {
"name": "lb01",
"provisioning_status": "ACTIVE",
"listeners": [
{
"name": "Listener 1",
"provisioning_status": "ACTIVE",
"pools": [
{
"name": "Pool 1",
"provisioning_status": "ACTIVE",
"healthmonitor": {
"provisioning_status": "ACTIVE",
"type": "HTTP",
"id": "80567969-c3b8-45fa-89f8-ac969bb21449",
"name": ""
},
"members": [
{
"name": "",
"provisioning_status": "ACTIVE",
"address": "10.0.0.13",
"protocol_port": 80,
"id": "67328b92-fe19-4c59-868d-6599bdeaeba0",
"operating_status": "ONLINE"
},
{
"name": "",
"provisioning_status": "ACTIVE",
"address": "10.0.0.12",
"protocol_port": 80,
"id": "e17d3eb6-d9cd-4f4c-8d51-756484c8f48c",
"operating_status": "ONLINE"
}
],
"id": "6183cf5f-8efe-44c5-8cfb-5cae52f3de04",
"operating_status": "ONLINE"
}
],
"l7policies": [],
"id": "270a57ce-3205-40fb-926f-201bb7d064ac",
"operating_status": "ONLINE"
}
],
"pools": [
{
"name": "Pool 1",
"provisioning_status": "ACTIVE",
"healthmonitor": {
"provisioning_status": "ACTIVE",
"type": "HTTP",
"id": "80567969-c3b8-45fa-89f8-ac969bb21449",
"name": ""
},
"members": [
{
"name": "",
"provisioning_status": "ACTIVE",
"address": "10.0.0.13",
"protocol_port": 80,
"id": "67328b92-fe19-4c59-868d-6599bdeaeba0",
"operating_status": "ONLINE"
},
{
"name": "",
"provisioning_status": "ACTIVE",
"address": "10.0.0.12",
"protocol_port": 80,
"id": "e17d3eb6-d9cd-4f4c-8d51-756484c8f48c",
"operating_status": "ONLINE"
}
],
"id": "6183cf5f-8efe-44c5-8cfb-5cae52f3de04",
"operating_status": "ONLINE"
}
],
"id": "db08bd1b-9f22-4281-8439-1ae808b79e54",
"operating_status": "ONLINE"
}
}
(neutron)
|
remove a load balancer.
root@controller:~# neutron
(neutron) lbaas-pool-list
+--------------------------------------+--------+----------+----------------+
| id | name | protocol | admin_state_up |
+--------------------------------------+--------+----------+----------------+
| 6183cf5f-8efe-44c5-8cfb-5cae52f3de04 | Pool 1 | HTTP | True |
+--------------------------------------+--------+----------+----------------+
(neutron) lbaas-pool-delete 6183cf5f-8efe-44c5-8cfb-5cae52f3de04
healthmonitor 80567969-c3b8-45fa-89f8-ac969bb21449 is using this pool
Neutron server returns request_ids: ['req-6c76ef5d-d046-4579-8020-509870dd1c1b']
(neutron) lbaas-healthmonitor-list
+--------------------------------------+------+------+----------------+
| id | name | type | admin_state_up |
+--------------------------------------+------+------+----------------+
| 80567969-c3b8-45fa-89f8-ac969bb21449 | | HTTP | True |
+--------------------------------------+------+------+----------------+
(neutron) lbaas-healthmonitor-delete 80567969-c3b8-45fa-89f8-ac969bb21449
Deleted healthmonitor: 80567969-c3b8-45fa-89f8-ac969bb21449
(neutron) lbaas-pool-delete 6183cf5f-8efe-44c5-8cfb-5cae52f3de04
Deleted pool: 6183cf5f-8efe-44c5-8cfb-5cae52f3de04
(neutron) lbaas-listener-list
+--------------------------------------+-----------------+------------+----------+---------------+----------------+
| id | default_pool_id | name | protocol | protocol_port | admin_state_up |
+--------------------------------------+-----------------+------------+----------+---------------+----------------+
| 270a57ce-3205-40fb-926f-201bb7d064ac | | Listener 1 | HTTP | 80 | True |
+--------------------------------------+-----------------+------------+----------+---------------+----------------+
(neutron) lbaas-listener-delete 270a57ce-3205-40fb-926f-201bb7d064ac
Deleted listener: 270a57ce-3205-40fb-926f-201bb7d064ac
(neutron) lbaas-loadbalancer-list
+--------------------------------------+------+-------------+---------------------+----------+
| id | name | vip_address | provisioning_status | provider |
+--------------------------------------+------+-------------+---------------------+----------+
| db08bd1b-9f22-4281-8439-1ae808b79e54 | lb01 | 10.0.0.4 | ACTIVE | haproxy |
+--------------------------------------+------+-------------+---------------------+----------+
(neutron) lbaas-loadbalancer-delete db08bd1b-9f22-4281-8439-1ae808b79e54
Deleted loadbalancer: db08bd1b-9f22-4281-8439-1ae808b79e54
(neutron)
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.