kolla项目是为了容器化openstack,目标是做到100个节点的开箱即用,所有的组件的HA都具备。kolla是一个革命性的项目,我们以前积累的安装部署经验,全部都报废。使用kolla可以快速部署可扩展,可靠的生产就绪的openstack环境。

基本环境

操作系统:CentOS Linux release 7.2.1511 (Core)
内核版本:3.10.0-327.28.3.el7.x86_64
docker版本:Docker version 1.12.1, build 23cf638

部署kolla

1. 安装依赖

yum install epel-release python-pip
yum install -y python-devel libffi-devel openssl-devel gcc
pip install -U pip
 

2. 修改docker启动文件

# 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
 

3. 重启docker

systemctl daemon-reload
systemctl restart docker
 

4. 安装docker的python库

yum install python-docker-py
or
pip install -U docker-py
 

5. 配置时间同步(此处略)

6. 禁用libvirt

systemctl stop libvirtd.service
systemctl disable libvirtd.service
 

7. 安装ansible

这里需要注意的是如果安装stable版的kolla需要Ansible < 2.0,master版需要Ansible > 2.0。默认yum安装ansible版本>2.0,因为我要安装stable/mitaka版,所有指定安装版本。

pip install -U ansible==1.9.4
 

8. 安装stable版kolla

  • 下载源码

    git clone https://git.openstack.org/openstack/kolla -b stable/mitaka
     
  • 安装依赖

    pip install -r kolla/requirements.txt -r kolla/test-requirements.txt
     
  • 源码安装

    pip install kolla/
     

9. 安装tox,生成配置文件

pip install -U tox
cd kolla/
tox -e genconfig
cp -rv etc/kolla /etc/
 

10. 安装python client

yum install python-openstackclient python-neutronclient
 

11. 本地docker仓库

all-in-one环境中本地仓库不是必须的这里没有配置

编译镜像

kolla-build
 

更多的编译选项可以参看:Building Container Images
如果个别镜像编译失败可以重新执行以上操作,因为docker的容器缓存,重新编译会很快
编译成功后生成的镜像如下所示:

# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kolla/centos-binary-heat-engine 2.0.3 28956cc878d3 20 hours ago 571.4 MB
kolla/centos-binary-heat-api-cfn 2.0.3 d69858fd13fa 20 hours ago 571.4 MB
kolla/centos-binary-heat-api 2.0.3 90a92ca6b71a 20 hours ago 571.4 MB
kolla/centos-binary-heat-base 2.0.3 8f1cf8a1f536 21 hours ago 551.6 MB
kolla/centos-binary-neutron-openvswitch-agent 2.0.3 e7d0233ca541 21 hours ago 822.3 MB
kolla/centos-binary-neutron-base 2.0.3 8767569ca9b3 21 hours ago 796.7 MB
kolla/centos-binary-openvswitch-vswitchd 2.0.3 6867586ae335 21 hours ago 330.6 MB
kolla/centos-binary-openvswitch-db-server 2.0.3 3c692f316662 21 hours ago 330.6 MB
kolla/centos-binary-openvswitch-base 2.0.3 c3a263463f8f 21 hours ago 330.6 MB
kolla/centos-binary-cron 2.0.3 d16d53e85ed9 26 hours ago 317.5 MB
kolla/centos-binary-kolla-toolbox 2.0.3 1fd9634b88ee 26 hours ago 568.4 MB
kolla/centos-binary-heka 2.0.3 627a3de5e91c 26 hours ago 371.1 MB
kolla/centos-binary-neutron-metadata-agent 2.0.3 aad43ed7a5a1 42 hours ago 796.7 MB
kolla/centos-binary-neutron-server 2.0.3 bc1a7c0ec402 42 hours ago 796.7 MB
kolla/centos-binary-nova-compute 2.0.3 619344ac721b 42 hours ago 1.055 GB
kolla/centos-binary-nova-libvirt 2.0.3 6144729fff5f 42 hours ago 1.106 GB
kolla/centos-binary-neutron-linuxbridge-agent 2.0.3 720c9c5fa63d 42 hours ago 822 MB
kolla/centos-binary-neutron-l3-agent 2.0.3 3a82df7cb9c2 42 hours ago 796.7 MB
kolla/centos-binary-glance-api 2.0.3 fb67115357d5 42 hours ago 673.8 MB
kolla/centos-binary-neutron-dhcp-agent 2.0.3 8c6fa56497ca 42 hours ago 796.7 MB
kolla/centos-binary-nova-compute-ironic 2.0.3 6f235dc430e5 43 hours ago 1.019 GB
kolla/centos-binary-glance-registry 2.0.3 f4cf7bc1536f 43 hours ago 673.8 MB
kolla/centos-binary-cinder-volume 2.0.3 0197cc13468d 43 hours ago 788.4 MB
kolla/centos-binary-cinder-api 2.0.3 ed7c623e7364 43 hours ago 800.4 MB
kolla/centos-binary-cinder-rpcbind 2.0.3 75466dc5a3ba 43 hours ago 790.2 MB
kolla/centos-binary-horizon 2.0.3 92c7ea9fc493 43 hours ago 703.1 MB
kolla/centos-binary-cinder-backup 2.0.3 e3ee19440831 43 hours ago 761.3 MB
kolla/centos-binary-cinder-scheduler 2.0.3 e3ee19440831 43 hours ago 761.3 MB
kolla/centos-binary-nova-consoleauth 2.0.3 96a9638801cd 43 hours ago 609.6 MB
kolla/centos-binary-nova-api 2.0.3 eff73f704a90 43 hours ago 609.4 MB
kolla/centos-binary-nova-conductor 2.0.3 6016ae01a60d 43 hours ago 609.4 MB
kolla/centos-binary-nova-scheduler 2.0.3 726f100a5533 43 hours ago 609.4 MB
kolla/centos-binary-nova-spicehtml5proxy 2.0.3 c6a1a49e4226 43 hours ago 609.9 MB
kolla/centos-binary-glance-base 2.0.3 1e4efa0f6701 43 hours ago 673.8 MB
kolla/centos-binary-nova-network 2.0.3 87f6389dd11a 43 hours ago 610.4 MB
kolla/centos-binary-ironic-pxe 2.0.3 82f25f73c28f 43 hours ago 574.2 MB
kolla/centos-binary-nova-novncproxy 2.0.3 4726875ed228 43 hours ago 610.1 MB
kolla/centos-binary-nova-ssh 2.0.3 51c70b9e9c47 43 hours ago 610.4 MB
kolla/centos-binary-cinder-base 2.0.3 7c2d031be713 43 hours ago 761.3 MB
kolla/centos-binary-keystone 2.0.3 c51a93cc9e2e 43 hours ago 585.2 MB
kolla/centos-binary-ironic-api 2.0.3 b1771f5cc27f 43 hours ago 570.6 MB
kolla/centos-binary-ironic-inspector 2.0.3 32f4e33e1037 43 hours ago 576.2 MB
kolla/centos-binary-ironic-conductor 2.0.3 d552c64f3a08 43 hours ago 599 MB
kolla/centos-binary-nova-base 2.0.3 8f077fafc5d8 43 hours ago 588.7 MB
kolla/centos-binary-rabbitmq 2.0.3 d9e543e4f179 43 hours ago 370.3 MB
kolla/centos-binary-ironic-base 2.0.3 6c4c453ddbce 43 hours ago 550.8 MB
kolla/centos-binary-openstack-base 2.0.3 cf48d5b3f3ee 43 hours ago 518.2 MB
kolla/centos-binary-mariadb 2.0.3 cd9b363fe034 43 hours ago 630.5 MB
kolla/centos-binary-memcached 2.0.3 49c536466427 43 hours ago 354.6 MB
kolla/centos-binary-base 2.0.3 d04ac1ecd01a 43 hours ago 300 MB
centos latest 980e0e4c79ec 2 days ago 196.7 MB
 

部署容器

1. 生成密码

openstack环境的密码等变量可以在 /etc/kolla/passwords.yml 中指定,为了方便可以使用kolla-genpwd工具自动生成复杂密码。

kolla-genpwd
 

为了方便,我们修改其中的管理员登陆密码

vim /etc/kolla/passwords.yml
keystone_admin_password: admin
 

2. 修改部署配置文件

修改/etc/kolla/globals.yml 文件,指定部署的一些信息

vim /etc/kolla/globals.yml

kolla_base_distro: "centos"
kolla_install_type: "binary"
enable_haproxy: "no"
#kolla_internal_vip_address: "10.10.10.254"
kolla_internal_address: "192.168.2.120"
network_interface: "ens160"
neutron_external_interface: "ens192"
neutron_plugin_agent: "openvswitch"
openstack_logging_debug: "True"
 

3. 检查配置

kolla-ansible prechecks
 

4. 开始部署

kolla-ansible deploy
 

5. 部署成功后查看容器

# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3938136934cf kolla/centos-binary-horizon:2.0.3 "kolla_start" 17 hours ago Up 17 hours horizon
cc68cb8d96e4 kolla/centos-binary-heat-engine:2.0.3 "kolla_start" 17 hours ago Up 17 hours heat_engine
96c94995ef7c kolla/centos-binary-heat-api-cfn:2.0.3 "kolla_start" 17 hours ago Up 17 hours heat_api_cfn
cb8ae3afb767 kolla/centos-binary-heat-api:2.0.3 "kolla_start" 17 hours ago Up 17 hours heat_api
e8f98659e03f kolla/centos-binary-neutron-metadata-agent:2.0.3 "kolla_start" 17 hours ago Up 17 hours neutron_metadata_agent
d326fa732c2b kolla/centos-binary-neutron-l3-agent:2.0.3 "kolla_start" 17 hours ago Up 17 hours neutron_l3_agent
4b1bbbe4fe5b kolla/centos-binary-neutron-dhcp-agent:2.0.3 "kolla_start" 17 hours ago Up 17 hours neutron_dhcp_agent
88b2afbba5d9 kolla/centos-binary-neutron-openvswitch-agent:2.0.3 "kolla_start" 17 hours ago Up 17 hours neutron_openvswitch_agent
b73d52de75b2 kolla/centos-binary-neutron-server:2.0.3 "kolla_start" 17 hours ago Up 17 hours neutron_server
1c716402d95f kolla/centos-binary-openvswitch-vswitchd:2.0.3 "kolla_start" 17 hours ago Up 17 hours openvswitch_vswitchd
176e7ee659f1 kolla/centos-binary-openvswitch-db-server:2.0.3 "kolla_start" 17 hours ago Up 17 hours openvswitch_db
457e0921c61a kolla/centos-binary-nova-ssh:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_ssh
b02acebb3dc3 kolla/centos-binary-nova-compute:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_compute
59be78a597d8 kolla/centos-binary-nova-libvirt:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_libvirt
668ad8f91920 kolla/centos-binary-nova-conductor:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_conductor
34f81b4bc18b kolla/centos-binary-nova-scheduler:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_scheduler
eb47844e6547 kolla/centos-binary-nova-novncproxy:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_novncproxy
93563016cf21 kolla/centos-binary-nova-consoleauth:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_consoleauth
cc8a1cca2e98 kolla/centos-binary-nova-api:2.0.3 "kolla_start" 17 hours ago Up 17 hours nova_api
40db89e89758 kolla/centos-binary-glance-api:2.0.3 "kolla_start" 17 hours ago Up 17 hours glance_api
4fa5f0f38f0d kolla/centos-binary-glance-registry:2.0.3 "kolla_start" 17 hours ago Up 17 hours glance_registry
f05120c95a9f kolla/centos-binary-keystone:2.0.3 "kolla_start" 17 hours ago Up 17 hours keystone
149a49d57aa6 kolla/centos-binary-rabbitmq:2.0.3 "kolla_start" 17 hours ago Up 17 hours rabbitmq
5f4298c3821e kolla/centos-binary-mariadb:2.0.3 "kolla_start" 17 hours ago Up 17 hours mariadb
64f6fbb19892 kolla/centos-binary-cron:2.0.3 "kolla_start" 17 hours ago Up 17 hours cron
4cab0e756b61 kolla/centos-binary-kolla-toolbox:2.0.3 "/usr/local/bin/dumb-" 17 hours ago Up 17 hours kolla_toolbox
293a7ccaab52 kolla/centos-binary-heka:2.0.3 "kolla_start" 17 hours ago Up 17 hours heka
6dcf3a2c12cc kolla/centos-binary-memcached:2.0.3 "kolla_start" 17 hours ago Up 17 hours memcached
 

6. 修改虚拟化类型

因为是在虚拟机中安装,不支持kvm,需要修改虚拟类型为qemu

vim /etc/kolla/nova-compute/nova.conf

[libvirt]
...
virt_type=qemu
 

然后就可以通过 kolla_internal_address 访问openstack环境

一些有用的工具

  1. 部署完成后,运行以下命令可以生成一个openrc文件(运行openstack CLI所需的环境变量):

    kolla-ansible post-deploy
     
  2. openrc文件生成之后,使用以下命令可以帮你做一下openstack的初始化工作,包括上传一个glance镜像以及创建几个虚拟网络:

    source /etc/kolla/admin-openrc.sh
    kolla/tools/init-runonce
     
  3. 由于错误的出现,可能需要多次的部署,而有些错误重新部署是不会进行修正的,所以需要将整个环境进行清理:

    tools/cleanup-containers                #可用于从系统中移除部署的容器
    tools/cleanup-host #可用于移除由于残余网络变化引发的docker启动的neutron-agents主机
    tools/cleanup-images #可用于从本地缓存中移除所有的docker image
     

日志查看

kolla通过heka容器来收集所有容器的日志

docker exec -it heka bash
 

所有的容器都可以从这个目录中获取服务日志:/var/log/kolla/SERVICE_NAME。
如果需要输出日志,请运行:

docker logs
 

大多数容器不会stdout,上面的命令将不会提供信息。

出错处理

deploy时遇到以下错误:

TASK: [rabbitmq | fail msg="Hostname has to resolve to IP address of api_interface"] ***
failed: [localhost] =&gt; (item={'cmd': ['getent', 'ahostsv4', 'localhost'], 'end': '2016-06-24 04:51:39.738725', 'stderr': u'', 'stdout': '127.0.0.1 STREAM localhost\n127.0.0.1 DGRAM \n127.0.0.1 RAW \n127.0.0.1 STREAM \n127.0.0.1 DGRAM \n127.0.0.1 RAW ', 'changed': False, 'rc': 0, 'item': 'localhost', 'warnings': [], 'delta': '0:00:00.033351', 'invocation': {'module_name': u'command', 'module_complex_args': {}, 'module_args': u'getent ahostsv4 localhost'}, 'stdout_lines': ['127.0.0.1 STREAM localhost', '127.0.0.1 DGRAM ', '127.0.0.1 RAW ', '127.0.0.1 STREAM ', '127.0.0.1 DGRAM ', '127.0.0.1 RAW '], 'start': '2016-06-24 04:51:39.705374'}) =&gt; {"failed": true, "item": {"changed": false, "cmd": ["getent", "ahostsv4", "localhost"], "delta": "0:00:00.033351", "end": "2016-06-24 04:51:39.738725", "invocation": {"module_args": "getent ahostsv4 localhost", "module_complex_args": {}, "module_name": "command"}, "item": "localhost", "rc": 0, "start": "2016-06-24 04:51:39.705374", "stderr": "", "stdout": "127.0.0.1 STREAM localhost\n127.0.0.1 DGRAM \n127.0.0.1 RAW \n127.0.0.1 STREAM \n127.0.0.1 DGRAM \n127.0.0.1 RAW ", "stdout_lines": ["127.0.0.1 STREAM localhost", "127.0.0.1 DGRAM ", "127.0.0.1 RAW ", "127.0.0.1 STREAM ", "127.0.0.1 DGRAM ", "127.0.0.1 RAW "], "warnings": []}}
msg: Hostname has to resolve to IP address of api_interface

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/root/site.retry

localhost : ok=87 changed=24 unreachable=0 failed=1
 

解决办法:

vim /etc/hosts
127.0.0.1 localhost
192.168.2.120 localhost
 

kolla的更多相关文章

  1. Inside Kolla - 05 从 tools 目录开始

    从 tools 目录开始 在上一篇中已介绍了 Kolla 的源代码目录结构和各个目录中源代码的基本作用,现在开始深入到各个目录,介绍目录中的具体内容.每个人分析代码的思路和方法不同,会选择从不同的目录 ...

  2. Inside Kolla - 04 Kolla 目录结构

    Kolla 目录结构 把 Kolla 的源代码下载下来后,先从总体上分析 Kolla 的目录结构,查看顶层目录结构,使用 tree -L 1 输出 . ├── ansible ├── compose ...

  3. Inside Kolla - 03 下载Kolla

    下载 Kolla Kolla 目前托管在 github.com 上,项目仓库的 URL 是 https://github.com/stackforge/kolla. 下载 Kolla 时,可下载 gi ...

  4. Inside Kolla - 02 Kolla 是什么

    Kolla 是什么? Kolla 项目 Kolla 是 OpenStack 里面的一个项目,在源代码的 README.md 里面的解析是: The Kolla project is part of t ...

  5. Inside Kolla - 01 简介

    简介 在 opencloud 2015 的会议上初次了解到 kolla 项目后,开始去了解和学习 kolla 的源代码和相关的知识.经过一段时间的了解,觉得 kolla 确实是一个很好的项目,它使用预 ...

  6. kolla管理openstack容器

    本文以nova-api容器为例,说明kolla如何将nova-api配置文件传入容器,容器如何启动nova-api服务并读取配置文件 注:第一部分比较无趣,二三部分 会有意思一些 1. nova-ap ...

  7. kolla 多节点部署 openstack

    kolla 介绍 简介 kolla 的使命是为 openstack 云平台提供生产级别的.开箱即用的交付能力.kolla 的基本思想是一切皆容器,将所有服务基于 Docker 运行,并且保证一个容器只 ...

  8. kolla queens on centos7.5 -all in one

    目录 环境准备 开始配置 快照,快照,快照 pull镜像并部署 登录配置OpenStack 环境准备 我这里用workstation创建了一个虚拟机,安装centos7.5 mini系统,这台虚拟机上 ...

  9. kolla单节点部署openstack

    virtualbox环境: 双网卡:enp0s3(桥接)   192.168.102.194 enp0s8(桥接)   无ip 块存储  50G 关闭防火墙,selinux. 配置yum源:wget  ...

  10. kolla之docker私有仓库创建

    kolla镜像自从P版以后就没有向之前版本直接下载一个tar然后放入仓库那么简单了. 正式开始搭建仓库: 1.启动仓库容器 docker run  -d -v /opt/registry:/var/l ...

随机推荐

  1. 写一个 Markdown 博客客户端

    这个"伪需求"是最近才想到的. 关于文章管理的想法,说来话长.我最初是在 CSDN 写技术文章,就用网页上的编辑器.后来在 CppBlog 写,用上了 Windows Live W ...

  2. AtCoder Beginner Contest 282 G - Similar Permutation

    套路题 题意 求有多少个 \(1\) 到 \(n\) 的排列满足恰有 \(k\) 对在排列中相邻的数满足前小于后 \(2 \leq n \leq 500, 0 \leq k \leq (n - 1)\ ...

  3. NG-ZORRO + Angular11增加自定义全局样式,不影响其他页面全局样式,仅作用于当前页面

    实现只需要两步 ts import { ViewEncapsulation } from '@angular/core';// 关键代码 @Component({ selector: 'app-tes ...

  4. SOFAJRaft源码阅读-Netty时间轮算法的实践

    SOFAJRaft的定时任务调度器是基于Netty来实现的,所以本文将会基于Netty时间轮算法,然后再结合SOFAJRaft源码进行分析. @Author:Akai-yuan @更新时间:2023/ ...

  5. C#高性能数组拷贝实验

    前言 昨天 wc(Wyu_Cnk) 提了个问题 C# 里多维数组拷贝有没有什么比较优雅的写法? 这不是问对人了吗?正好我最近在搞图像处理,要和内存打交道,我一下就想到了在C#里面直接像C/C++一样做 ...

  6. Java 进阶P-1.3+P-1.4

    成员变量和成员函数 成员变量 类定义了对象中所具有的变量,这些变量称作成员变量 每个对象都有自己的变量,和同一个类的其他对象是分开的 成员方法 在 Java 语言中使用成员方法对应于类对象的行为.以 ...

  7. FLASH-CH32F203替换STM32F103 FLASH快速编程移植说明

    因CH32F203 相对于STM32 flash 操作多了快速编程模式,该文档说明主要目的是为了方便客户在原先ST 工程的基础上实现flash 快速编程模式的快速移植. 1.在stm32f10x.h ...

  8. JVM参数:带你认识-X和-XX参数

    摘要:JVM参数分为三类:标准参数.非标准参数(-X参数)和高级选项(-XX参数).本文主要为大家讲解-X参数和-XX参数. 本文分享自华为云社区<JVM运行参数之-X和-XX参数>,作者 ...

  9. 自动化运维:使用Maven与Docker运行Selenium测试

    在这篇文章中,我们将向您展示如何创建交付流水线并实现以下目标: 使用Web应用程序构建Docker镜像 在Docker容器中运行该应用程序 从不同的容器中使用Maven运行Selenium测试 出于本 ...

  10. KingbaseES dblink异常unsupported for database link

    KingbaseES使用dblink查询报错:unsupported for database link 适用于: KingbaseES所有版本. 问题现象: KingbaseES创建kingbase ...