Load Balancer as a Service (LBaaS V2.0)


1.安装服务以及配置

yum install openstack-neutron-lbaas haproxy

 

修改/etc/neutron/neutron.conf 的[DEFAULT]部分:

crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins router,neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2

如果已有定义的 plugins,可以用以下方是区分:

service_plugins = [already defined plugins], neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2

 

修改/etc/neutron/neutron_lbaas.conf的[service_providers]选项:

crudini --set /etc/neutron/neutron_lbaas.conf service_providers service_provider LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default

 

修改/etc/neutron/lbaas_agent.ini的[DEFAULT]部分:

crudini --set /etc/neutron/lbaas_agent.ini DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver

 

更新neutron数据库

neutron-db-manage --service lbaas --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head

 

重启服务

systemctl restart neutron-server

systemctl enable neutron-lbaasv2-agent.service

systemctl start neutron-lbaasv2-agent.service

 

 

2.添加 LBaas 到 Dashboard(默认新版ALLINONE Dashboard 没有安装lbassV2)

安装 dashboard plugin

git clone https://git.openstack.org/openstack/neutron-lbaas-dashboard

cd neutron-lbaas-dashboard

git checkout stable/mitaka

python setup.py install

cp neutron-lbaas-dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/

 

修改配置文件 /etc/openstack-dashboard/local_settings:

OPENSTACK_NEUTRON_NETWORK = {

    ...

    'enable_lb': True

    ...

 

重启httpd服务

systemctl restart httpd

 

3.创建 Load balancer

neutron lbaas-loadbalancer-create --name test-lb 474c2c02-3c70-46d5-bb5a-761ceb46827f

 

创建vip_port的安全组

neutron security-group-create lbaas

eutron security-group-rule-create \

  --direction ingress \

  --protocol tcp \

  --port-range-min 80 \

  --port-range-max 80 \

  --remote-ip-prefix 0.0.0.0/0 \

  lbaas

 neutron security-group-rule-create \

  --direction ingress \

  --protocol icmp \

  lbaas

neutron port-update \

>   --security-group lbaas \

> 7dabd3e1-3fcb-4699-97da-9a11676f6269(注:vip_port_id)

 

创建 Listener :

neutron lbaas-listener-create \

  --name test-lb-http \

  --loadbalancer test-lb \

  --protocol HTTP \

  --protocol-port 80

 

创建 Pool :

neutron lbaas-pool-create \

  --name test-lb-pool-http \

  --lb-algorithm ROUND_ROBIN \

  --listener test-lb-http \

  --protocol HTTP

 

创建 Member :

neutron lbaas-member-create \

  --subnet private-subnet \

  --address 10.0.0.5 \

  --protocol-port 80 \

  test-lb-pool-http

 

neutron lbaas-member-create \

  --subnet private-subnet \

  --address 10.0.0.4 \

  --protocol-port 80 \

  test-lb-pool-http

 

创建 Health monitor :

neutron lbaas-healthmonitor-create \

  --delay 5 \

  --max-retries 2 \

  --timeout 10 \

  --type HTTP \

  --pool test-lb-pool-http

 

绑定浮动IP:

neutron floatingip-associate FLOATINGIP_ID LOAD_BALANCER_PORT_ID


查了很久的资料,终于可以实现lbaasv2.0的功能了,请支持原创,谢谢。


你可能感兴趣的:(openstack)