Openstack自动化部署工具, 主要用于生产环境.
以下操作重复性不太好, 主要是网络环境的问题, 有些安装包下载会超时. 如果是学习openstack的话, 推荐安装packstack或者devstack.
这里用的是Openstack 9.0版本.
Fuel Documentation
下载Fuel for OpenStack镜像文件, 用于安装Feul Master.
安装Xshell, 用于远程连接.
安装xftp, 用于从Windows主机向虚拟机传输文件.
管理->全局设定->网络->仅主机(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
名称: 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镜像文件装入.
打开fuel_master电源, 开始安装. 中间会进入到一个配置菜单. 配置内容如下图所示:
事实上, 我在安装的时候, 并没有选择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可以与主机互通, 且可以访问外网.
软路由的教程由参见软路由篇 – 爱快路由安装与配置. 通过软路由, 我还顺便解决了之前虚拟机无法上网的问题.
按照上述教程配置好软路由之后, 主机和fuel_master就可以实现互联了. 但是fuel_master仍然无法连接外网. ping百度的结果如下:
ping: unknown host www.baidu.com
因为我的DNS没有设置, 导致了ping不通外网. 将DNS添加到该文件中, 该DNS是我主机的DNS地址:
为了后续的操作方便, 我用Xshell和Xftp连接了fuel_master.
主机: 10.20.0.2
端口号: 22
用户名: root
密码: r00tme
如果无法访问Fuel UI, 但主机与虚拟机又能相互ping通的话, 可能是因为虚拟机的防火墙的问题. 可以通过在Xshell中创建隧道的方式解决:
隧道->Forwarding Rule
源主机: localhost
侦听端口: 8443
目标主机: 10.20.0.2
目标端口: 8443
通过Xftp来将文件从主机传到虚拟机. 连接配置如下图所示:
在之前的步骤中, 由于网络问题, 我们没有创建成功bootstrap image. 打开 /var/www/nailgun 目录, 发现目录下现在是没有 mirrors 这个文件夹的.
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:
用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
创建配置:
名称: 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.
设置->系统->网络启动->启动顺序: 将网络启动调为第一个.
直接clone虚拟机fuel_controller.
选择重新初始化所有网卡的MAC地址.
选择完全复制. 将内存设为2GB.
打开这两台虚拟机.
通过主机浏览器进入https://10.20.0.2:8443/. 可以看到, 新加的两个节点已经能够被发现了.
添加controller节点.
添加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
回到控制台, 再次尝试部署.
官网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指令建立本地源, 如何建立本地源还没有解决.