| Works
OpenStackでNeutronのLBaaSを有効にする
社内のOpenStack環境にロードバランサーを追加したときのメモ。
環境はRHEL 7とRed Hat Enterprise Linux OpenStack Platform 5 [Icehouseベース])の組み合わせです。
必要なパッケージをインストールします。
OpenStackをPackstackでインストールした場合、OpenStack関連のパッケージ(主にNeutronとか)で必要なものは基本的に入っていると思います。
自分の試した環境では"haproxy"が入っていなかったので"yum"で追加します。
# yum -y install haproxy
"/usr/share/neutron/neutron-dist.conf"ファイルに以下の記述があることを確認します。(デフォルトで有効になっているはずです。)
[service_providers]
service_provider = LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
続いて設定ファイル"neutron.conf"と"lbaas_agent.ini"の変更をします。
"neutron.conf"は"service_plugins"にロードバランサープラグインを追記します。
(実行例の"neutron.services.loadbalancer.plugin.LoadBalancerPlugin")
# crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \
neutron.services.l3_router.l3_router_plugin.L3RouterPlugin,\
neutron.services.firewall.fwaas_plugin.FirewallPlugin,\
neutron.services.loadbalancer.plugin.LoadBalancerPlugin
"lbaas_agent.ini"で変更するのは"interface_driver"、"device_driver"、"user_group"です。
(RHEL 6.5とかのときは"ovs_use_veth"をTrueにする必要がある?)
# crudini --set /etc/neutron/lbaas_agent.ini DEFAULT interface_driver \
neutron.agent.linux.interface.OVSInterfaceDriver
# crudini --set /etc/neutron/lbaas_agent.ini DEFAULT device_driver \
neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
# crudini --set /etc/neutron/lbaas_agent.ini haproxy user_group haproxy
Neutronの設定は以上ですが、GUIから操作できるようにHorizonの設定も変更します。
"/etc/openstack-dashboard/local_settings"ファイルの"enable_lb"をTrueにします。
(以下、該当部分周辺を抜粋)
OPENSTACK_NEUTRON_NETWORK = {
'enable_lb': True,
'enable_firewall': True,
'enable_quotas': True,
'enable_security_group': True,
'enable_vpn': False,
}
neutron-lbaas-agentを起動し、その他の関連サービスを再起動します。
# systemctl enable neutron-lbaas-agent
# systemctl start neutron-lbaas-agent
# systemctl restart neutron-server
# systemctl restart httpd
以上でロードバランサーが使えるようになりました。
# openstack-status | grep neutron
== neutron services ==
neutron-server: active
neutron-dhcp-agent: active
neutron-l3-agent: active
neutron-metadata-agent: active
neutron-lbaas-agent: active
neutron-openvswitch-agent: active
neutron-linuxbridge-agent: inactive (disabled on boot)
neutron-ryu-agent: inactive (disabled on boot)
neutron-nec-agent: inactive (disabled on boot)
neutron-mlnx-agent: inactive (disabled on boot)
neutron-metering-agent: inactive (disabled on boot)
動作確認とかはそのうち。