部署安裝Mirantis OpenStack Fuel 9.0

Openstack自動化部署工具, 主要用於生產環境.

以下操作重複性不太好, 主要是網絡環境的問題, 有些安裝包下載會超時. 如果是學習openstack的話, 推薦安裝packstack或者devstack.

一. 環境準備

這裏用的是Openstack 9.0版本.

Fuel Documentation

下載Fuel for OpenStack鏡像文件, 用於安裝Feul Master.

安裝Xshell, 用於遠程連接.

安裝xftp, 用於從Windows主機向虛擬機傳輸文件.

二. 安裝fuel_master節點

1. VirtualBox網絡配置

管理->全局設定->網絡->僅主機(Host-Only)網絡

新建三張新的網卡:

Host-Only Ethernet Adapter
IPv4: 10.20.0.10
Mask: 255.255.255.0
DHCP: Unable

Host-Only Ethernet Adapter #2
IPv4: 172.16.0.254
Mask: 255.255.255.0
DHCP: Unable

Host-Only Ethernet Adapter #3
IPv4: 172.16.1.1
Mask: 255.255.255.0
DHCP: Unable

2. 創建虛擬機fuel_master

(1) 創建配置

名稱: fuel_master
類型: Linux
版本: Red Hat (64-bit)
內存: 2GB
虛擬磁盤: 默認選項. 大小設爲100GB(至少50GB).

安裝的時候可以把master節點的內存調大一點, 裝的更快一些.

網絡:

網卡1:
Attached to: Host-Only Adapter.
Name: VirtualBox Host-Only Ethernet Adapter
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

網卡2:
Attached to: Host-Only Adapter.
Name: VirtualBox Host-Only Ethernet Adapter #2
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

網卡3:
Attached to: NAT.
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

某個教程裏提到, 只有PCnet-PCI II(Am79C970A)這個控制芯片才能支持PXE啓動. 第一次安裝時, 我使用了PCnet-PCI II(Am79C970A), 但一直無法解決虛擬機連接外網的問題, 因此又重裝了一次. 第二次一開始用的是PCnet-PCI II(Am79C970A), 出現了虛擬機ping不通網關10.20.0.1的情況. 改用Interl PRO/1000 MT 桌面(82540EM)後就可以ping通網關了. 不知道爲什麼, 有待分析.

光驅: 將Fuel for OpenStack鏡像文件裝入.

(2) 開始安裝

打開fuel_master電源, 開始安裝. 中間會進入到一個配置菜單. 配置內容如下圖所示:

Bootstrap Image

事實上, 我在安裝的時候, 並沒有選擇Skip building bootstrap image選項. 在安裝過程中, 由於這步需要連到國外ubuntu源, 所以這步執行失敗了, 一直卡在這裏不動. 所以我乾脆直接重啓了fuel_master, 不知道有沒有除了building bootstrap image以外的步驟被我跳過了. 在下次安裝的時候, 可以直接勾選Skip building bootstrap image選項, 跳過這步.

安裝結束後得到:

Fuel UI: http://10.20.0.2:8443/
Default admin: root
Default admin password: r00tme

Default Fuel UI: admin
Default Fuel UI password: admin

在一開始的嘗試中, 我將虛擬機的第一張網卡設置爲10.20.0.1. 按照正常安裝步驟, 此時應該fuel_master應該可以和主機相互ping通. 但是我的情況是相互都ping不通. 多次嘗試無解後, 引入了軟路由來解決這個問題. 不過在後續嘗試中, 發現根本沒必要通過軟路由來解決這個問題. 把fuel_master的第三張網卡, 即eth2打開即可.

vim /etc/sysconfig/network-scripts/ifcfg-eth2

修改:

ONBOOT=yes # 系統啓動時是否設置此網絡接口, 設置爲yes時, 系統啓動時激活此設備

到此爲止, fuel_master可以與主機互通, 且可以訪問外網.

(3) 軟路由 (這步可以略過)

軟路由的教程由參見軟路由篇 – 愛快路由安裝與配置. 通過軟路由, 我還順便解決了之前虛擬機無法上網的問題.

按照上述教程配置好軟路由之後, 主機和fuel_master就可以實現互聯了. 但是fuel_master仍然無法連接外網. ping百度的結果如下:

ping: unknown host www.baidu.com

因爲我的DNS沒有設置, 導致了ping不通外網. 將DNS添加到該文件中, 該DNS是我主機的DNS地址:

DNS設置

(4) 使用Xshell和Xftp連接虛擬機

爲了後續的操作方便, 我用Xshell和Xftp連接了fuel_master.

Xshell創建連接

主機: 10.20.0.2
端口號: 22
用戶名: root
密碼: r00tme

如果無法訪問Fuel UI, 但主機與虛擬機又能相互ping通的話, 可能是因爲虛擬機的防火牆的問題. 可以通過在Xshell中創建隧道的方式解決:

隧道->Forwarding Rule
源主機: localhost
偵聽端口: 8443
目標主機: 10.20.0.2
目標端口: 8443

Xftp創建連接

通過Xftp來將文件從主機傳到虛擬機. 連接配置如下圖所示:

xftp

(5) 用創建bootstrap image

在之前的步驟中, 由於網絡問題, 我們沒有創建成功bootstrap image. 打開 /var/www/nailgun 目錄, 發現目錄下現在是沒有 mirrors 這個文件夾的.

nailgun目錄

Openstack官網給我們提供了動態創建的方法: Dynamically build Ubuntu-based bootstrap on master node. 我直接下載Mirantis OpenStack Fuel9.0離線安裝(MOS9.0本地源)中提供的bootstrap image. 在此感謝該博主, 他的文章給我帶來了很大幫助. 具體下載地址如下:

MOS9.0 bootstrap下載:http://pan.baidu.com/s/1gfc4w6n 密碼:o9x4

解壓下載的bootstraps壓縮包,得到4個文件, 如下圖所示. 將這4個文件壓縮爲tar.gz文件, 得到active_bootstrap.tar.gz:

bootstrap文件

用Xftp把active_bootstrap.tar.gz傳到fuel_master的任意位置. import並activate該bootstrap:

fuel-bootstrap import active_bootstrap.tar.gz
fuel-bootstrap activate d01c72e6-83f4-4a19-bb86-6085e40416e6

import
activate

3. 創建虛擬機fuel_controller和fuel_computer

(1) 創建虛擬機fuel_controller

創建配置:

名稱: fuel_controller
類型: Linux
版本: Red Hat (64-bit)
內存: 1GB
虛擬磁盤: 默認選項. 大小設爲100GB.

網絡:

網卡1:
Attached to: Host-Only Adapter.
Name: VirtualBox Host-Only Ethernet Adapter
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

網卡2:
Attached to: Host-Only Adapter.
Name: VirtualBox Host-Only Ethernet Adapter #2
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

網卡3:
Attached to: Host-Only Adapter.
Name: VirtualBox Host-Only Ethernet Adapter #3
Adapter Type: Interl PRO/1000 MT 桌面(82540EM).
Promiscuous Mode(混雜模式): All.

設置->系統->網絡啓動->啓動順序: 將網絡啓動調爲第一個.

(2) 創建虛擬機fuel_computer

直接clone虛擬機fuel_controller.
選擇重新初始化所有網卡的MAC地址.
選擇完全複製. 將內存設爲2GB.

(3) 部署openstack

打開這兩臺虛擬機.

打開虛擬機

通過主機瀏覽器進入https://10.20.0.2:8443/. 可以看到, 新加的兩個節點已經能夠被發現了.

這裏寫圖片描述

添加controller節點.

添加controller節點

添加compute節點

添加compute節點

配置網絡接口

配置網絡接口

點擊 網絡->驗證網絡. 驗證網絡的目的是檢查與 Repositories 下地址的連通性. 我在這裏將源配置爲上海交通大學的ubutnu源.

deb http://ftp.sjtu.edu.cn/ubuntu/ trusty main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

源配置

網絡驗證通過.

驗證網絡

點擊 控制檯->部署.

開始部署

部署過程中在4%出現錯誤中斷, 錯誤信息如下:

錯誤
Provision has failed. Failed to execute hook 'shell' Failed to run command cd / && fa_build_image --image_build_dir /var/lib/fuel/ibp --log-file /var/log/fuel-agent-env-1.log --data_driver nailgun_build_image --input_data '{"image_data": {"/boot": {"container": "gzip", "uri": "http://10.20.0.2:8080/targetimages/env_1_ubuntu_1404_amd64-boot.img.gz", "format": "ext2"}, "/": {"container": "gzip", "uri": "http://10.20.0.2:8080/targetimages/env_1_ubuntu_1404_amd64.img.gz", "format": "ext4"}}, "output": "/var/www/nailgun/targetimages", "repos": [{"name": "ubuntu", "section": "main multiverse restricted universe", "uri": "http://ftp.sjtu.edu.cn/ubuntu/", "priority": null, "suite": "trusty", "type": "deb"}, {"name": "ubuntu-updates", "section": "main multiverse restricted universe", "uri": "http://ftp.sjtu.edu.cn/ubuntu/", "priority": null, "suite": "trusty-updates", "type": "deb"}, {"name": "ubuntu-security", "section": "main multiverse restricted universe", "uri": "http://ftp.sjtu.edu.cn/ubuntu/", "priority": null, "suite": "trusty-security", "type": "deb"}, {"name": "mos", "section": "main restricted", "uri": "http://10.20.0.2:8080/mirrors/mos-repos/ubuntu/9.0", "priority": 1000, "suite": "mos9.0", "type": "deb"}, {"name": "mos-updates", "section": "main restricted", "uri": "http://10.20.0.2:8080/mirrors/mos-repos/ubuntu/9.0", "priority": 1000, "suite": "mos9.0-updates", "type": "deb"}, {"name": "mos-security", "section": "main restricted", "uri": "http://10.20.0.2:8080/mirrors/mos-repos/ubuntu/9.0", "priority": 1000, "suite": "mos9.0-security", "type": "deb"}, {"name": "mos-holdback", "section": "main restricted", "uri": "http://10.20.0.2:8080/mirrors/mos-repos/ubuntu/9.0", "priority": 1000, "suite": "mos9.0-holdback", "type": "deb"}, {"name": "Auxiliary", "section": "main restricted", "uri": "http://10.20.0.2:8080/mitaka-9.0/ubuntu/auxiliary", "priority": 1150, "suite": "auxiliary", "type": "deb"}], "packages": ["acl", "anacron", "bash-completion", "bridge-utils", "bsdmainutils", "build-essential", "cloud-init", "curl", "daemonize", "debconf-utils", "gdisk", "grub-pc", "hpsa-dkms", "hwloc", "i40e-dkms", "linux-firmware", "linux-firmware-nonfree", "linux-headers-generic-lts-trusty", "linux-image-generic-lts-trusty", "lvm2", "mcollective", "mdadm", "multipath-tools", "multipath-tools-boot", "nailgun-agent", "nailgun-mcagents", "network-checker", "ntp", "openssh-client", "openssh-server", "puppet", "python-amqp", "ruby-augeas", "ruby-ipaddress", "ruby-json", "ruby-netaddr", "ruby-openstack", "ruby-shadow", "ruby-stomp", "telnet", "ubuntu-minimal", "ubuntu-standard", "uuid-runtime", "vim", "virt-what", "vlan"], "codename": "trusty"}' (node master returned 255).

發現是因爲Repositories裏的mos鏡像地址有問題, 修改如下 :

mosmos:
deb http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0 mos9.0 main restricted
mos-updates:
deb http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0 mos9.0-updates main restricted
mos-security:
deb http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/ mos9.0-security main restricted
mos-holdback:
deb http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0 mos9.0-holdback main restricted

回到控制檯, 再次嘗試部署.

(4) 關於Repositories

官網Configuring repositories給出的解釋是:

You may need to configure repositories to:

Download Ubuntu packages
Apply patches

By default, your OpenStack environments have the configuration of the
repositories that point to the Mirantis update and security repository
mirrors. There is also an Auxiliary repository configured on the Fuel
Master node, which can be used to deliver packages to the nodes.

Source repository flexibility in OpenStack deployment using Fuel鼓勵通過fuel-createmirror指令建立本地源, 如何建立本地源還沒有解決.


參考文獻

  1. 軟路由篇 – 愛快路由安裝與配置
  2. Mirantis OpenStack Fuel9.0離線安裝(MOS9.0本地源)
  3. Mirantis OpenStack Fuel8.0離線安裝(MOS8.0本地源)
  4. Source repository flexibility in OpenStack deployment using Fuel
  5. Configuring repositories
  6. Dynamically build Ubuntu-based bootstrap on master node
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章