..
聲明:
本博客歡迎轉發,但請保留原作者信息!
博客地址:http://blog.csdn.net/liujiong63
新浪微博:@Jeremy____Liu
內容系本人學習、研究和總結,如有雷同,實屬榮幸!
環境:centos7.2.1511
安裝epel源並升級pip
yum install -y epel-release
yum -y update
yum install -y python-pip
pip install –U pip
安裝依賴
yum install -y python-devel libffi-devel gcc openssl-devel git
安裝docker
yum -y install docker-io
配置docker
修改MountFlags選項
vim /usr/lib/systemd/system/docker.service
在service節加上
MountFlags=shared
保存退出,重新加載配置,重啓docker服務
systemctl daemon-reload
systemctl restart docker
安裝最新版docker-py
yum install -y python-docker-py
或者
pip install -U docker-py
配置時間同步
ntpdate asia.pool.ntp.org
禁用libvirt
systemctl stop libvirtd.service
systemctl disable libvirtd.service
安裝ansible
yum install -y ansible
或者
pip install ansible
克隆kolla倉庫stable/ocata分支
git clone https://git.openstack.org/openstack/kolla -b stable/ocata
安裝kolla及其依賴
pip install -r kolla/requirements.txt -r kolla/test-requirements.txt
pip install kolla/
安裝tox,生成配置文件
pip install -U tox
cd kolla/
tox -e genconfig
cp -rv etc/kolla /etc/
安裝client
yum install http://mirror.centos.org/centos/7/cloud/x86_64/openstack-ocata/centos-release-openstack-ocata-1-1.el7.noarch.rpm -y
yum install python-openstackclient python-neutronclient
編譯鏡像
kolla-build --base centos --type binary
查看編譯後的鏡像
docker images
部署容器
生成密碼
OpenStack環境的密碼等變量可以在 /etc/kolla/passwords.yml 中指定,爲了方便可以使用kolla-genpwd工具自動生成複雜密碼。
kolla-genpwd
爲了方便,我們修改其中的管理員登陸密碼
vim /etc/kolla/passwords.yml
keystone_admin_password: admin
修改部署配置文件
修改/etc/kolla/globals.yml 文件,指定部署的一些信息:
vim /etc/kolla/globals.yml
kolla_base_distro: "centos"
kolla_install_type: "binary"
openstack_release: "4.0.0"
# This should be a VIP, an unused IP on your network that will float between
# the hosts running keepalived for high-availability. When running an All-In-One
# without haproxy and keepalived, this should be the first IP on your
# 'network_interface' as set in the Networking section below.
kolla_internal_vip_address: "192.168.0.112
network_interface: "eno16777736"
neutron_external_interface: "eno16777736"
neutron_plugin_agent: "openvswitch"
openstack_logging_debug: "True"
檢查配置
kolla-ansible prechecks
開始部署
kolla-ansible deploy
部署成功後查看容器
docker ps
添加iptables
yum install iptables-services -y
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 6080 -j ACCEPT
service iptables save
修改虛擬化類型
因爲是在虛擬機中安裝,不支持kvm,需要修改虛擬類型爲qemu
vim /etc/kolla/nova-compute/nova.conf
[libvirt]
...
virt_type=qemu
配置網卡
若使用單網卡,在部署到 neutron-ovs 容器的時候會斷網, 需要配置 br-ex網橋,配置內容如下:
cat /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=OVSPort
DEVICE=eno16777736
ONBOOT=yes
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
vim /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.0.112
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
重啓網絡服務:
systemctl restart network
然後就可以通過 kolla_internal_vip_address 訪問OpenStack環境