安裝和配置控制節(jié)點(diǎn)(Controller node)
在配置Openstack網(wǎng)絡(luò)(項(xiàng)目代號(hào)為neutron)服務(wù)前馍资,需要?jiǎng)?chuàng)建相關(guān)數(shù)據(jù)庫(kù)膀捷、服務(wù)認(rèn)證service credentials
、API入口endpoints
- 創(chuàng)建數(shù)據(jù)庫(kù)
$ mysql -uroot -p
mysql> create database neutron;
mysql> grant all privileges on neutron.* to 'neutron'@'localhost' \
identified by '123456' with grant option;
mysql> grant all privileges on neutron.* to 'neutron'@'%' \
identified by '123456' with grant option;
mysql> exit;
- 切換到
admin
用戶環(huán)境焕梅,以獲得admin-only
CLI權(quán)限
$ . admin-openrc
- 創(chuàng)建
neutron
服務(wù)認(rèn)證
創(chuàng)建neutron
用戶
$ openstack user create --domain default --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | 5d9c95b32eaa4d80934f5d5d765bd3f5 |
| enabled | True |
| id | c5be46da15fb42fc9b96a1b1c884fb6b |
| name | neutron |
| password_expires_at | None |
+---------------------+----------------------------------+
neutron
用戶添加admin
角色
$ openstack role add --project service --user neutron admin
此命令無(wú)輸出
創(chuàng)建neutron
服務(wù)入口
$ openstack service create --name neutron \
--description "OpenStack Networking" network
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | 1ce836e494024e4ea9e2e7899cf01e09 |
| name | neutron |
| type | network |
+-------------+----------------------------------+
- 創(chuàng)建Networking服務(wù)的
API endpoints
$ openstack endpoint create --region RegionOne \
network public http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7184c9fcc8d544d7a3957c9810ce4142 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network internal http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7228694155f440eda571df686b6c49be |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network admin http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 224bcf7ffa934baba1f75e029f64abab |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
配置 networking 選項(xiàng)
可以選擇option 1
或option 2
架構(gòu)以部署Networking
服務(wù)迹鹅。
-
Option 1
架構(gòu)是最簡(jiǎn)單的,只支持將虛擬機(jī)實(shí)例接入provider(external)
網(wǎng)絡(luò)贞言,沒(méi)有self-service(private)
網(wǎng)絡(luò)斜棚、routers
以及floating IP(浮動(dòng)IP)
。僅有admin
用戶或其他同級(jí)用戶可管理provider
網(wǎng)絡(luò) -
Option 2
架構(gòu)則使用layer-3
服務(wù)擴(kuò)展了option 1
该窗,支持虛擬機(jī)實(shí)例使用self-service
網(wǎng)絡(luò)弟蚀。demo
用戶或其他用戶可以自行管理self-service
網(wǎng)絡(luò),包括routers以及floating IP
酗失。floating IP
可以讓虛擬機(jī)實(shí)例通過(guò)self-service
網(wǎng)絡(luò)訪問(wèn)external
網(wǎng)絡(luò)义钉,例如外網(wǎng)。self-service
網(wǎng)絡(luò)的數(shù)據(jù)包會(huì)使用 1500 的MTU
值
Option 2
同樣支持將虛擬機(jī)實(shí)例接入provider
網(wǎng)絡(luò)
配置完成下述任一網(wǎng)絡(luò)架構(gòu)后规肴,再回到這里繼續(xù)配置 metadata 代理
- Option 1: Provider 網(wǎng)絡(luò) 部署
-Option 2: Self-service 網(wǎng)絡(luò)
配置metadata agent
metadata agent用于提供配置信息捶闸,例如虛擬機(jī)實(shí)例的憑據(jù)
- 編輯
/etc/neutron/metadata_agent.ini
[DEFAULT]
...
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET #可以設(shè)置為其他合適的密碼
配置Compute service
使用網(wǎng)絡(luò)服務(wù)
- 編輯
/etc/nova/nova.conf
[neutron]
...
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = neutron
password = 123456
service_metadata_proxy = true
metadata_proxy_shared_secret = METADATA_SECRET
安裝收尾
# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini \
/etc/neutron/plugin.ini
# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
# systemctl restart openstack-nova-api.service
- 對(duì)于
option 1
和option 2
,都需要如下操作
# systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
# systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
- 對(duì)于
option 2
拖刃,還需要啟用layer-3
服務(wù)
# systemctl enable neutron-l3-agent.service
# systemctl start neutron-l3-agent.service