lbv2啟用loadbalancer ssl卸載服務(wù)

安裝lbv2

首先是安裝lbv2的流程,如果是p之后的版本lbaas應(yīng)該是默認(rèn)v2的:
1.控制節(jié)點(diǎn):yum install -y openstack-neutron-lbaas
2.修改配置文件(采用octavia參考config-lbaas):
neutron.conf:

[defualt]
service_plugins = [existing service plugins],neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
        
[service_providers]
service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default

lbaas_agent.ini:

interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver     

3.更新數(shù)據(jù)庫:neutron-db-manage --subproject neutron-lbaas upgrade head
4.啟動(dòng)agent:

 systemctl enable neutron-lbaasv2-agent
 systemctl start neutron-lbaasv2-agent
 systemctl restart neutron-server

5.安裝dashboard:

git clone https://git.openstack.org/openstack/neutron-lbaas-dashboard -b stable/pike
cd  neutron-lbaas-dashboard     
python setup.py install  
      
cp neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py     /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/      
          
./manage.py collectstatic
./manage.py compress       
       
####最后/etc/openstack-dashboard/ 的local_settings開啟 UI:
OPENSTACK_NEUTRON_NETWORK = {
'enable_lb': True,
...
}
###重啟httpd
systemctl restart httpd

安裝barbican

barbican是openstack單獨(dú)的一個(gè)組件,主要用于密鑰管理(key manage)。目前有很多組件使用了barbican的密鑰管理。對(duì)于lbaas來講,可以使用barbican為loadbalancer提供ssl的密鑰管理。

接下來記錄下barbican的安裝流程:具體的步驟可以參考:barbican-install

但上面的這個(gè)步驟,有幾處注意一下:
1.編輯/etc/httpd/conf.d/wsgi-barbican.conf 文件時(shí),我使用VirtualHost 0.0.0.0:9311替換了VirtualHost [::1]:9311并且在/etc/httpd/conf/ports文件里添加了Listen 0.0.0.0:9311才使得httpd加載barbican服務(wù)。還有如下修改:

vim /etc/httpd/conf.d/wsgi-barbican.conf
<VirtualHost 0.0.0.0:9311>
    ServerName 192.168.99.2
      
    ## Logging
    ErrorLog "/var/log/httpd/barbican_wsgi_main_error_ssl.log"
    LogLevel debug
    ServerSignature Off
    CustomLog "/var/log/httpd/barbican_wsgi_main_access_ssl.log" combined
      
    <Directory "/usr/lib/python2.7/site-packages/barbican">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Allow from all
      Require all granted
    </Directory>
         
    WSGIApplicationGroup %{GLOBAL}
    WSGIDaemonProcess barbican-api display-name=barbican-api group=barbican processes=2 threads=8 user=barbican
    WSGIProcessGroup barbican-api
    WSGIScriptAlias / "/usr/lib/python2.7/site-packages/barbican/api/app.wsgi"
    WSGIPassAuthorization On
</VirtualHost>

2.編輯/etc/barbican/barbican.conf,修改和增加如下配置:

[DEFAULT]
transport_url = rabbit://guest:guest@controller
host_href = http://xxx.xxx.xxx.xxx:9311
log_file = /var/log/barbican/api.log

3.檢查barbican服務(wù)是否啟動(dòng),可以先通過以下命令查看是否者報(bào)錯(cuò):

openstack secret list
+--------------------------------------------------------------------------+-------------+---------------------------+--------+-----------------------------+-----------+------------+-------------+------+------------+
| Secret href                                                              | Name        | Created                   | Status | Content types               | Algorithm | Bit length | Secret type | Mode | Expiration |
+--------------------------------------------------------------------------+-------------+---------------------------+--------+-----------------------------+-----------+------------+-------------+------+------------+
| http://192.168.99.2:9311/v1/secrets/8a1b6444-216e-44a7-a049-8b15d83dcdc1 | mysecret    | 2018-03-25T17:40:58+00:00 | ACTIVE | {u'default': u'text/plain'} | aes       |        256 | opaque      | cbc  | None

若報(bào)錯(cuò),可以再查看9311端口是否監(jiān)聽,以及查看日志/var/log/barbican/api.log和/var/log/httpd/:

netstat -lnp | grep 9311
tcp        0      0 0.0.0.0:9311            0.0.0.0:*               LISTEN      15773/httpd

4.允許外部訪問9311端口:

iptables -I INPUT -p tcp --dport 9311 -j ACCEPT

lbv2啟用ssl卸載服務(wù)

ssl卸載服務(wù)(TERMINATED_HTTPS):lbv2的loadbalancer可以對(duì)外提供https服務(wù),對(duì)于到來的流量會(huì)將ssl卸載,并提供給內(nèi)部的http服務(wù)器。
具體的步驟可以參考:tls-balancer-install

上面的步驟對(duì)于現(xiàn)在的版本,有些過時(shí)了,所以有以下幾處注意的:
1.首先,barbican客戶端屬于將要廢棄的,所以使用openstack客戶端命令,例如創(chuàng)建secret(其它步驟類似):

openstack secret store --payload-content-type='text/plain' --name='certificate' --payload="$(cat server.crt)"

2.修改/etc/neutron/neutron_lbaas.conf不能按照官方的配置auth_uri:

auth_url = 192.168.99.2:5000/v2.0
auth_version = 3

3.創(chuàng)建安全組規(guī)則的命令,也廢棄了,我采用的neutron客戶端(default是對(duì)象組名,這里簡略,應(yīng)采用對(duì)象組id):

neutron neutron security-group-rule-create --direction ingress --protocol tcp --port-range-min 22 --port-range-max 22 default
neutron neutron security-group-rule-create --direction egress --protocol tcp --port-range-min 22 --port-range-max 22 default
neutron security-group-rule-create --direction ingress --protocol icmp default

除此之外,還有好些命令都已過時(shí),使用的時(shí)候,最好先了解命令參數(shù)的意思,然后正確使用。

總結(jié)

以上是lbv2啟用ssl卸載服務(wù)的步驟,并沒有詳細(xì)敘述安裝的細(xì)節(jié),因?yàn)楣俜桨惭b步驟都有,重要的是指出安裝的幾處坑,避免下次安裝的時(shí)候再次踩坑。當(dāng)然,不得不提的是Octavia項(xiàng)目將會(huì)取代lbv2,也就是說如果換成Octavia,前面所提到的安裝配置,就要以O(shè)ctavia相關(guān)的為準(zhǔn)。

個(gè)人分析,歡迎指正,若轉(zhuǎn)載請(qǐng)注明出處!
歡迎訪問我的主頁

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容