加入docker 源
cat > /etc/yum.repos.d/docker.repo << EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
安装EPEL源
yum install -y epel-release
yum install python-pip
pip install -U pip
pip -V
yum install deltarpm -y
curl -sSL https://get.docker.io | bash
注意:这个命令将安装docker最近的稳定版,但是请注意,Kolla发布不与docker同步,所以有些地方阻止新版本docker的工作,docker 版本要>=1.0.0,查看的命令为:
docker --version
修改docker文件:这一步是必学要做的,否则在deploy的时候 会报错:
# Create the drop-in unit directory for docker.service
mkdir -p /etc/systemd/system/docker.service.d
# Create the drop-in unit file
tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF'
[Service]
MountFlags=shared
EOF
重启docker:
systemctl daemon-reload
systemctl restart docker
安装docker-python:
yum install python-docker-py
或者:
pip install -U docker-py
yum install -y ntp
systemctl enable ntpd.service
systemctl start ntpd.service
systemctl stop libvirtd.service
systemctl disable libvirtd.service
yum install -y ansible
或者:
pip install -U ansible (需要先安装依赖:“yum install -y python-devel libffi-devel git gcc python-setuptools openssl-devel”)
安装kolla依赖:
yum install -y python-devel libffi-devel git gcc python-setuptools openssl-devel
安装kolla:
pip install kolla
cp -r /usr/share/kolla/etc_examples/kolla /etc/
git clone https://git.openstack.org/openstack/kolla
pip install -r kolla/requirements.txt -r kolla/test-requirements.txt
cd kolla
cp -r etc/kolla /etc/
安装python 客户端:
yum install python-devel libffi-devel openssl-devel gcc
yum install python-openstackclient python-neutronclient
或者
pip install -U python-openstackclient python-neutronclient
pip install tox
tox -e genconfig
cp -rv etc/kolla /etc/
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf ## 开启ipv4转发,不然build会报错 !
sysctl -p
kolla-build --base centos --type source -p default
参数中的 -p default 是指定了只 build 主要的 image, 包括 : mariadb, rabbitmq, cinder, ceilometer, glance, heat, horizon, keystone, neutron, nova, swift 等 . 这些可以只生成的 kolla-build.conf 里找到。
如果 Build 完成之后,使用 docker images 能看到所有已经 build 好的镜像。
依然是先修改配置文件,与 Deploy 相关的主要是两个配置文件 /etc/kolla/passwords.yml 和 /etc/kolla/globals.yml。他们为 ansible 提供一些变量的设定。主要需要修改的是 globals.yml 文件。修改后,其主要内容为 :
config_strategy: "COPY_ALWAYS"
kolla_base_distro: "centos"
kolla_install_type: "source"
kolla_internal_address: "10.2.0.254"
network_interface: "eth0"
neutron_external_interface: "eth1"
openstack_logging_debug: "true"
enable_cinder: "no"
enable_heat: "no"
kolla 使用一个名为 kolla-ansible 的封装脚本, 并提供以下几个命令
./tools/kolla-ansible -h
Usage: ./tools/kolla-ansible COMMAND [options]
Options:
--inventory, -i Specify path to ansible inventory file
--playbook, -p Specify path to ansible playbook file
--keyfile, -k Specify path to ansible vault keyfile
--help, -h Show this usage information
--tags, -t Only run plays and tasks tagged with these values
Commands:
prechecks Do pre-deployment checks for hosts
deploy Deploy and start all kolla containers
post-deploy Do post deploy on deploy node
pull Pull all images for containers (only pulls, no runnnig container changes)
可以使用 ./tools/kolla-ansible prechecks 来检查一个机器是否满足安装条件。
使用 ./tools/kolla-ansible deploy 来开始正式安装。安装会很快,我机器上,几分钟就安装完成了。
最后,使用 ./tools/kolla-ansible post-deploy 来生成 /etc/kolla/admin-openrc.sh 文件用来加载认证变量。
IMAGE COMMAND NAMES
lokolla/centos-source-keystone:2.0.0 "kolla_start" keystone
lokolla/centos-source-horizon:2.0.0 "kolla_start" horizon
lokolla/centos-source-neutron-metadata-agent:2.0.0 "kolla_start" neutron_metadata_agent
lokolla/centos-source-neutron-l3-agent:2.0.0 "kolla_start" neutron_l3_agent
lokolla/centos-source-neutron-dhcp-agent:2.0.0 "kolla_start" neutron_dhcp_agent
lokolla/centos-source-neutron-openvswitch-agent:2.0.0 "kolla_start" neutron_openvswitch_agent
lokolla/centos-source-neutron-server:2.0.0 "kolla_start" neutron_server
lokolla/centos-source-openvswitch-vswitchd:2.0.0 "kolla_start" openvswitch_vswitchd
lokolla/centos-source-openvswitch-db-server:2.0.0 "kolla_start" openvswitch_db
lokolla/centos-source-nova-compute:2.0.0 "kolla_start" nova_compute
lokolla/centos-source-nova-libvirt:2.0.0 "kolla_start" nova_libvirt
lokolla/centos-source-nova-conductor:2.0.0 "kolla_start" nova_conductor
lokolla/centos-source-nova-scheduler:2.0.0 "kolla_start" nova_scheduler
lokolla/centos-source-nova-novncproxy:2.0.0 "kolla_start" nova_novncproxy
lokolla/centos-source-nova-consoleauth:2.0.0 "kolla_start" nova_consoleauth
lokolla/centos-source-nova-api:2.0.0 "kolla_start" nova_api
lokolla/centos-source-glance-api:2.0.0 "kolla_start" glance_api
lokolla/centos-source-glance-registry:2.0.0 "kolla_start" glance_registry
lokolla/centos-source-rabbitmq:2.0.0 "kolla_start" rabbitmq
lokolla/centos-source-mariadb:2.0.0 "kolla_start" mariadb
lokolla/centos-source-memcached:2.0.0 "kolla_start" memcached
lokolla/centos-source-keepalived:2.0.0 "kolla_start" keepalived
lokolla/centos-source-haproxy:2.0.0 "kolla_start" haproxy
lokolla/centos-source-kolla-toolbox:2.0.0 "/bin/sleep infinity" kolla_toolbox
lokolla/centos-source-heka:2.0.0 "kolla_start" heka
lokolla/centos-source-rsyslog:2.0.0 "kolla_start" rsyslog
多数 container 里是由 kolla_start 这个脚本启动起来的
由于 kolla 使用的是 –net=host 网络,所以没有必要做端口映射
每个模块拆分成了多个 container, 如 nova 被拆分成了 nova_api, nova_libvirt, nova_conductor, nova_novncproxy, nova_compute 等多个 container。很好的遵守了一个容器一个进程的原则。