kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点

简介

Opencontrail4.0 引入了容器化的Contrail架构,基于该容器化架构,用户能以docker容器的形式运行所有的Contrail组件,包括控制/配置,分析,分析数据库和vRouter-agent。本文档旨在指导用户通过Openstack-kolla来安装openContrail。整个安装过程参考文档[1][2][3],文档[2]中Contrail-ansible安装contrail容器,kolla-ansible负责安装openstack容器,kolla-ansible通过设定特定的参数来使用contrail已定制化的nova-compute和neutron容器,然后运行openstack环境,nova和neutron容器中改变的参数将激活opencontrail功能。

所有的contrail容器都是公开可用,在docker hub上可以找到,参考[4][5][6]。

环境要求

  1. 用户可使用物理服务器或者虚拟机,可以根据文档安装单节点或者多节点集群

  2. Ubuntu 16.04.2 LTS, Kernel: 4.4.0-62-generic(系统保证ubuntu16.04.2)

  3. 机器上有2个网卡,第一个网卡被用于作为contrail-vrouter的接口和openstack服务接口;第二个网卡可以没有ip,基本没有使用.两个网卡是kolla特定的要求,第二个网卡用于openstack的隧道网段,对接过程中实际没有使用。

  4. 32GB的内存,考虑到集群的使用,150GB硬盘空间

  5. 如果使用虚拟机,需要使虚拟机支持嵌套虚拟化[7][8]

  6. 设置root权限访问机器

机器准备

虚拟机环境

  1. vmware创建虚拟机

    强烈建议 CPU:2*4 32GB 100GB,我之前通过虚拟机安装过程中,用于自身虚拟机配置不够,多次安装成功后,过几分钟后,服务就故障。

  2. 查看虚拟机是开启了虚拟,参考1,参考2

    # egrep "vmx|svm" /proc/cpuinfo
    

    如果没有开启虚拟化请开启虚拟化,重启系统reboot生效

  3. 创建两个网卡,保证两个网卡可以连接互联网

    ens160作为openstack环境管理网ip,隧道网ip,存储网Ip。ens160也作为host默认路由,可以 连接外网,用于远程horizon登录和下载依赖包。

    ens192作为外网ip,需保证ens192可联通互联网,后面br-ex绑定这个网卡,虚拟机是通过这块网卡访问外网

服务器环境准备

虚拟机安装过程中后,由于公司虚拟机配置资源受限,使用的人过多,导致服务不稳定,果断换服务器安装了。

  1. 重装服务器,系统ubuntu16.04.2

  2. 两个网卡准备

    eno3.201作为openstack环境管理网ip,隧道网ip,存储网Ip。eno3.201也作为host默认路由,可以 连接外网,用于远程horizon登录和下载依赖包。

    eno3.204作为外网ip,需保证eno3.204可联通互联网,后面br-ex绑定这个网卡,虚拟机是通过这块网卡访问外网

    note: 自身实验室环境中进行了vlan隔离,物理服务器第三个网口所连接的交换机放行了201-204 vlan tag,所以服务器操作系统安装完后,自己手动添加vlan tag用于与外界连通。识个人情况可以自行跳过,只需保证两块网卡能访问互联网即可。

    具体配置如下:

    vi /etc/network/interfaces
    
    auto lo
    iface lo inet loopback
    
    auto eno3
    iface eno3 inet static
    address 192.168.27.200
    netmask 255.255.255.0
    
    auto eno3.201
    iface eno3.201 inet static
    address 192.168.27.52
    netmask 255.255.255.0
    network 192.168.27.0
    broadcast 192.168.27.255
    gateway 192.168.27.254
    dns-nameservers 10.19.8.10
    
    auto eno3.204
    iface eno3.204 inet static
    address 192.168.30.35
    netmask 255.255.255.0
    

为了保证物理机器开机后,vlan tag自动添加,作如下配置

vi /etc/rc.local

vconfig add eno3 201
vconfig add eno3 204

eno3.201 作为管理ip 192.168.27.52

eno3.204 作为外网ip 192.168.30.35

环境软件包下载

  1. 源更新

备份源信息,更新阿里源

root@opencontrail:~# cd /etc/apt/
root@opencontrail:/etc/apt# ls
apt.conf.d  preferences.d  sources.list  sources.list~  sources.list.d  trusted.gpg  trusted.gpg.d
root@opencontrail:/etc/apt# cp sources.list sources.list.bak
root@opencontrail:/etc/apt# > sources.list
root@opencontrail:/etc/apt# vi sources.list

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

apt-get update

2.修改主机名

查看修改本机

vi /etc/hostname
opencontrail

vi /etc/hosts

127.0.0.1       localhost
192.168.27.52   opencontrail

3.设置root

新装系统需要设置root账户,保证机器可以ssh

4.安装NTP

apt-get install ntp

手工同步时间
apt-get install ntpdate
ntpdate 0.centos.pool.ntp.org

然后reboot机器

5.基础包下载

apt-get update
apt-get install python-pip sshpass python-oslo-config python-dev libffi-dev gcc libssl-dev qemu-kvm
pip install -U pip

pip install ansible    #Upgrades pip to the latest version
pip install  pyOpenSSL==16.2.0

6.docker安装

本文档中docker指定安装1.13.1,kolla-ansible安装脚本会检测docker版本,这里提前安装好,参考[9]

6.1 Ubuntu导入软件仓库证书

apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

6.2 新增一个 docker.list 文件,在其中增加对应的软件安装源.

以 Ubuntu 16.04 为例:
vim  /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo ubuntu-xenial main

6.3 更新软件源

apt-get update

6.4 显示软件源中所有Docker软件包安装信息

apt-cache policy docker-engine

6.5 移除其它版本Docker

如果之前存在其它版本的Docker,可以使用以下命令先移出:

apt-get purge docker-engine

6.6 安装指定版本Docker

根据实际情况,选定要安装的 Docker 版本进行安装。这里以安装 1.13.1 版本为例:

apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual

apt-get install docker-engine=1.13.1-0~ubuntu-xenial

6.7 验证Docker版本

docker -v
Docker version 1.13.1, build 092cba3

7.设置docker

添加

[Service]
MountFlags=shared
ExecReload=/bin/kill -s HUP $MAINPID --insecure-registry 192.168.26.100:4000

note: 192.168.26.100:4000是自己搭建的本地docker Registry,由于本地网速受限,建立本地仓库还是非常有必要的,可以保证后面流畅的进行安装,后面可参考docker本地仓库搭建。

具体配置参考如下:

vi /lib/systemd/system/docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket firewalld.service
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart = /usr/bin/dockerd $DOCKER_OPTS
ExecReload=/bin/kill -s HUP $MAINPID --insecure-registry 192.168.26.100:4000
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
MountFlags=shared
EnvironmentFile = /etc/default/docker

[Install]
WantedBy=multi-user.target

重启 docker

systemctl daemon-reload && systemctl restart docker

本地docker registry搭建

  1. 搭建Registry服务器,该虚拟机第一个网卡ip为192.168.26.100 ,创建第二个网卡

    默认docker的registry是使用5000端口,对于OpenStack来说,有端口冲突,所以我将端口改成了4000。

    # docker run -d -v /opt/registry:/var/lib/registry -p 4000:5000 \
    --restart=always --name registry registry:2
    
    [root@kolla ~]# docker ps -a
    de67c9de6dbb        registry:2                                                                "/entrypoint.sh /etc/"   28 hours ago        Up 2 hours          0.0.0.0:4000->5000/tcp   registry
    [root@kolla ~]# netstat -antl |grep 4000
    tcp6       0      0 :::4000                 :::*                    LISTEN
    [root@kolla ~]#
    
  2. 上传openstack和contrail集成所需docker容器镜像到本地仓库

本地docker registry搭建也是在之前安装过openstack 和Contrail失败的虚拟机上搭建的,刚好利用已经下载好的部分容器。

在虚拟机中
git clone https://github.com/gokulpch/OpenContrail-Kolla.git

参考文档[1][2][3]进行配置集成配置参数,

配置环境

ansible-playbook -i inventory/all-in-one -e @../etc/kolla/globals.yml -e @../etc/kolla/passwords.yml -e      action=bootstrap-servers kolla-host.yml

下载openstack 所需的包,将action 修改为pull

 ansible-playbook -vvv -i inventory/all-in-one -e @../etc/kolla/globals.yml -e @../etc/kolla/passwords.yml -e action=pull site.yml

contrail需要的包比较少,手动下载。

 保证集成所需的包下载齐全 openstack-kolla :4.0.0
 在docker hub上可以下载
 docker gokulpch上下载 contrail:4.0.1.0-12
 docker gokulpch 下载 neutron-server nova :5.0.0,后面本地修改为4.0.1.0-12

这里我自己把5.0.0的tag更改为4.0.1.0-12,与使用的Contrail控制器的tag一致
然后修改容器tag,并上传到本地仓库。

上传脚本如下:

vi docker-hub.sh

#!/bin/bash

docker_hub=192.168.26.100:4000
image_num=`docker images |grep -v REPOSITORY |grep -v $docker_hub|wc -l`
i=0
while [ "$i" != "$image_num" ]
do
    i=$[ $i + 1]
    echo $i
    rep=`docker images |grep -v REPOSITORY |grep -v $docker_hub|sed -n "$i, 1p" |awk '{print $1}'`
    tag=`docker images |grep -v REPOSITORY |grep -v $docker_hub|sed -n "$i, 1p" |awk '{print $2}'`
    docker tag $rep:$tag $docker_hub/$rep:$tag
    docker push $docker_hub/$rep:$tag
done

上传过程中国若出现http鉴权问,请确认–insecure-registry 192.168.26.6:4000是否配置。

另外本地docker registry所在虚拟机可以配置docker加速,方便容器镜像下载。

 vi /etc/default/docker

 DOCKER_OPTS="    --insecure-registry  192.168.26.100:4000          "
DOCKER_OPTS="--registry-mirror=https://tc4nnrym.mirror.aliyuncs.com"

上面说太多废话了,总之你要能保证本地仓库可以下载如下包,这样后面的安装脚本才能流畅的跑完。

root@opencontrail:~/OpenContrail-Kolla# docker images
REPOSITORY                                                          TAG                 IMAGE ID            CREATED             SIZE
192.168.26.100:4000/ubuntu-binary-nova-compute                      4.0.1.0-12          450b41535756        2 months ago        749 MB
192.168.26.100:4000/contrail-controller-ubuntu16.04                 4.0.1.0-12          7dea82024842        2 months ago        1.62 GB
192.168.26.100:4000/ubuntu-binary-neutron-server                    4.0.1.0-12          d664ec321729        2 months ago        570 MB
192.168.26.100:4000/contrail-analyticsdb-ubuntu16.04                4.0.1.0-12          eef9ea4d3c87        2 months ago        1.03 GB
192.168.26.100:4000/contrail-analytics-ubuntu16.04                  4.0.1.0-12          5390dd006542        2 months ago        682 MB
192.168.26.100:4000/contrail-agent-ubuntu16.04                      4.0.1.0-12          e51a384f1f08        2 months ago        763 MB
192.168.26.100:4000/kolla/ubuntu-binary-keystone                    4.0.0               1a035bf1c0b9        7 months ago        493 MB
192.168.26.100:4000/kolla/ubuntu-binary-heat-api                    4.0.0               1299800fd4b3        7 months ago        485 MB
192.168.26.100:4000/kolla/ubuntu-binary-heat-api-cfn                4.0.0               2946843486b4        7 months ago        485 MB
192.168.26.100:4000/kolla/ubuntu-binary-heat-engine                 4.0.0               3add04a3dd03        7 months ago        485 MB
192.168.26.100:4000/kolla/ubuntu-binary-neutron-openvswitch-agent   4.0.0               4ab813497a91        7 months ago        550 MB
192.168.26.100:4000/kolla/ubuntu-binary-neutron-metadata-agent      4.0.0               421ed3204347        7 months ago        550 MB
192.168.26.100:4000/kolla/ubuntu-binary-neutron-l3-agent            4.0.0               f75c8221d616        7 months ago        571 MB
192.168.26.100:4000/kolla/ubuntu-binary-neutron-dhcp-agent          4.0.0               7a69b44dfb05        7 months ago        572 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-placement-api          4.0.0               ef60a65a0212        7 months ago        554 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-ssh                    4.0.0               4de9923c4d87        7 months ago        568 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-novncproxy             4.0.0               7e4d3806e82d        7 months ago        569 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-api                    4.0.0               c2e784775111        7 months ago        556 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-scheduler              4.0.0               da1170e46c1a        7 months ago        545 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-conductor              4.0.0               2fe2bcf9471d        7 months ago        545 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-consoleauth            4.0.0               e9b691659800        7 months ago        545 MB
192.168.26.100:4000/kolla/ubuntu-binary-glance-api                  4.0.0               512e47e49838        7 months ago        520 MB
192.168.26.100:4000/kolla/ubuntu-binary-glance-registry             4.0.0               7923878f1f71        7 months ago        509 MB
192.168.26.100:4000/kolla/ubuntu-binary-horizon                     4.0.0               e12b05b4e18e        7 months ago        627 MB
192.168.26.100:4000/kolla/ubuntu-binary-nova-libvirt                4.0.0               eb83fcad2c64        7 months ago        794 MB
192.168.26.100:4000/kolla/ubuntu-binary-kolla-toolbox               4.0.0               317a409e7902        7 months ago        745 MB
192.168.26.100:4000/kolla/ubuntu-binary-fluentd                     4.0.0               45bf0c0cf6c0        7 months ago        638 MB
192.168.26.100:4000/kolla/ubuntu-binary-openvswitch-db-server       4.0.0               a6bca512f39e        7 months ago        328 MB
192.168.26.100:4000/kolla/ubuntu-binary-cron                        4.0.0               ce87f2463ebc        7 months ago        299 MB
192.168.26.100:4000/kolla/ubuntu-binary-openvswitch-vswitchd        4.0.0               107e66ff5286        7 months ago        328 MB
192.168.26.100:4000/kolla/ubuntu-binary-mariadb                     4.0.0               53d3e150e05b        7 months ago        620 MB
192.168.26.100:4000/kolla/ubuntu-binary-rabbitmq                    4.0.0               ffa38653ee1e        7 months ago        361 MB
192.168.26.100:4000/kolla/ubuntu-binary-memcached                   4.0.0               2a13ba206e1b        7 months ago        320 MB
root@opencontrail:~/OpenContrail-Kolla# 

安装组件介绍

contrail-ansible:

运行playbooks来安装Contrail-Controller,Contrail-Analytics,Contrail-AnalyticsDB

脚本会安装Contrail-Vrouter-Agent容器,将要求的配置信息上传到内核中,并启动vRouter

用户可以基于自己的环境信息,在all.yml和host文件中配置信息

kolla-ansible:

运行playbook以容器形式安装所有openstack服务

采用要求的参数来使用Contrail仓库中定制化的neutron和nova容器,参数在globals.yml中配置

用户可以使用all-in-one的配置文件来安装单节点的Contrail和openstack集群。也可以配置多节点集群。

配置信息介绍

  1. 下载安装包

    git clone https://github.com/gokulpch/OpenContrail-Kolla.git
    
  2. 配置Openstack-kolla

2.1 基于自身机器信息,适配openstack环境

vi OpenContrail-Kolla/kolla-ansible/etc/kolla/globals.yml

network_interface: "eno3.201" ----第一个网卡

neutron_external_interface: "eno3.204"    ---第二个网卡

contrail_api_interface_address: "192.168.27.52"

docker_registry: "192.168.26.100:4000"
docker_namespace: "kolla"


nova_compute_image_full: "192.168.26.100:4000/ubuntu-binary-nova-compute:4.0.1.0-12"
neutron_server_image_full: "192.168.26.100:4000/ubuntu-binary-neutron-server:4.0.1.0-12"
enable_neutron_opencontrail: "yes"
contrail_api_interface_address: "192.168.27.52"

这里我将作者的5.0.0镜像tag更改为自己本地的,源镜像还是用的作者gokulpch中的5.0.0

2.2 修改openstack密码信息

vi OpenContrail-Kolla/kolla-ansible/etc/kolla/passwords.yml

  所有的密码都是使用contrail1,
  这里我放开metada,与作者不一致
  metadata_secret: contrail1
  不然后面安装会报错

2.3. OpenContrail-Kolla/kolla-ansible/ansible/inventory/all-in-one

不变,单节点安装

3.配置contrail-ansible

3.1 配置contrail 配置节点清单信息

主要是改变管理网Ip

vi OpenContrail-Kolla/contrail-ansible/playbooks/inventory/my-inventory/hosts



# Enable contrail-repo when required - this will start a contrail apt or yum repo container on specified node
# This repo will be used by other nodes on installing any packages in the node
# setting up contrail-cni need this repo enabled
# NOTE: Repo is required only for mesos and nested mode kubernetes
#;[contrail-repo]
#;192.168.0.24

[contrail-controllers]
192.168.27.52

[contrail-analyticsdb]
192.168.27.52

[contrail-analytics]
192.168.27.52

[contrail-config]
192.168.27.52

[contrail-compute]
192.168.27.52

##
# Only enable if you setup with openstack (when cloud_orchestrator is openstack)
##
[openstack-controllers]
192.168.27.52

# Kubernetes Nested Mode.
# Underlay Contrail Api Server to which kubernetes instance should
# connect to. This is to be set for ONLY for nested kubernetes installation.
#;[kubernetes-contrail-controllers]
#;192.168.0.24

# Kubernetes Nested Mode.
# Underlay Contrail Analytics Server to which kubernetes instance should
# connect to. This is to be set for ONLY for nested kubernetes installation.
#;[kubernetes-contrail-analytics]
#;192.168.0.24

3.2 更改Contrail的配置信息

vi OpenContrail-Kolla/contrail-ansible/playbooks/inventory/my-inventory/group_vars/all.yml
1. 更改docker_registry: "192.168.26.100:4000"

2. 更改rabbitmq的ip和密码
# global_config:
global_config: { external_rabbitmq_servers: 192.168.27.52 }
rabbitmq_config: { user: openstack, password: contrail1 }

3.更改keystone
keystone_config: {ip: 10.87.1.49, admin_password: contrail1, auth_protocol: http}

第一个网卡信息,这个应该和openstack-kolla中globals.yml的network_interface一样
vrouter_physical_interface: eno3.201

部分配置信息示例如下:

###################################################
# Docker configurations
##
# docker registry
docker_registry: "192.168.26.100:4000"
docker_registry_insecure: True

# install docker from package rather than installer from get.docker.com which is default method
docker_install_method: package

###################################################
# Ansible specific vars
##

# ansible connection details
ansible_user: root
ansible_become: true
# ansible_ssh_private_key_file: ~/.ssh/id_rsa

###################################################
# Common settings for contrail
##

# contrail_compute_mode - the values are bare_metal to have bare_metal agent setup and "container" for agent container
# default is bare_metal
contrail_compute_mode: container

# os_release - operating system release - ubuntu 14.04 - ubuntu14.04, ubuntu 16.04 - ubuntu16.04, centos 7.1 - centos7.1, centos 7.2 - centos7.2
os_release: ubuntu16.04

# contrail version
contrail_version: 4.0.1.0-12

# cloud_orchestrator - cloud orchestrators to be setup
# Valid cloud orchestrators:
# kubernetes, mesos, openstack, openshift
cloud_orchestrator: openstack

# vrouter physical interface
vrouter_physical_interface: eno3.201

安装Openstack-kolla

cd OpenContrail-Kolla/kolla-ansible/ansible/

初始化配置 Host

ansible-playbook -i inventory/all-in-one -e @../etc/kolla/globals.yml -e @../etc/kolla/passwords.yml -e      action=bootstrap-servers kolla-host.yml

开始安装 Openstack Containers-Kolla

ansible-playbook -vvv -i inventory/all-in-one -e @../etc/kolla/globals.yml -e @../etc/kolla/passwords.yml -e action=deploy site.yml

安装成功后,信息如下:

PLAY [Apply role octavia] **********************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/system/setup.py
 ESTABLISH LOCAL CONNECTION FOR USER: root
 EXEC /bin/sh -c 'echo ~ && sleep 0'
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490 `" && echo ansible-tmp-1510226194.39-56679170543490="` echo /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490 `" ) && sleep 0'
 PUT /tmp/tmpfr_sKZ TO /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490/setup.py
 EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490/ /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490/setup.py && sleep 0'
 EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490/setup.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1510226194.39-56679170543490/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [octavia : include] ***********************************************************************************************************************************************************************************
task path: /root/OpenContrail-Kolla/kolla-ansible/ansible/roles/octavia/tasks/main.yml:2
skipping: [localhost] => {
    "changed": false,
    "skip_reason": "Conditional result was False",
    "skipped": true
}
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************************************************************
localhost                  : ok=252  changed=125  unreachable=0    failed=0

root@opencontrail:~/OpenContrail-Kolla/kolla-ansible/ansible#

安装contrail-ansible

ssh信息配置

Generate keys:

ssh-keygen -t rsa

copy keys:


ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

disable host checking:

export ANSIBLE_HOST_KEY_CHECKING=False

开始安装contrail容器

cd OpenContrail-Kolla/contrail-ansible/playbooks/ 
ansible-playbook  -i inventory/my-inventory site.yml

安装成功后,信息如下:

TASK [node : Register analytics node with controller] ******************************************************************************************************************************************************
changed: [192.168.27.52] => (item={'key': u'192.168.27.52', 'value': u'opencontrail'})

TASK [node : Register analyticsdb node with controller] ****************************************************************************************************************************************************
changed: [192.168.27.52] => (item={'key': u'192.168.27.52', 'value': u'opencontrail'})

TASK [node : Register compute node with controller] ********************************************************************************************************************************************************
changed: [192.168.27.52] => (item={'key': u'192.168.27.52', 'value': u'opencontrail'})
 [WARNING]: Could not match supplied host pattern, ignoring: openstack


PLAY [Configure Neutron Plugin on External Openstack Nodes] ************************************************************************************************************************************************
skipping: no hosts matched

PLAY [Reboot compute nodes] ********************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [192.168.27.52]

TASK [Reboot node] *****************************************************************************************************************************************************************************************
changed: [192.168.27.52]

TASK [Waiting for server to come back] *********************************************************************************************************************************************************************
ok: [192.168.27.52 -> localhost]
 [WARNING]: Could not match supplied host pattern, ignoring: ceph-compute


PLAY [Setup ceph compute node] *****************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP *************************************************************************************************************************************************************************************************
192.168.27.52              : ok=118  changed=40   unreachable=0    failed=0
localhost                  : ok=1    changed=0    unreachable=0    failed=0

root@opencontrail:~/OpenContrail-Kolla/contrail-ansible/playbooks# ansible-playbook  -i inventory/my-inventory site.yml

修正horizon的bug

docker exec -i horizon bash
 ----进入horizon容器
sudo sed -i -e 's:/usr/share/openstack-dashboard/static:/var/lib/openstack-dashboard/static:g' /etc/apache2/conf-enabled/000-default.conf

/usr/share/openstack-dashboard/manage.py collectstatic --noinput

/usr/share/openstack-dashboard/manage.py compress
              ----note:以上两步有点慢,请耐心等待
sudo service apache2 reload

exit  --离开容器

环境验证

构建环境变量
vi /root/admin-openrc.sh

export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=contrail1
export OS_AUTH_URL=http://192.168.27.52:35357/v3
export OS_INTERFACE=internal
export OS_IDENTITY_API_VERSION=3

创建初始网络

编辑 vi OpenContrail-Kolla/kolla-ansible/tools/init-runonce,主要是修改外网,以及提前下载好cirros镜像文件到根目录

EXT_NET_CIDR='192.168.30.0/24'
EXT_NET_RANGE='start=192.168.30.100,end=192.168.30.200'
EXT_NET_GATEWAY='192.168.30.254'
运行脚本
source /root/admin-openrc.sh
bash OpenContrail-Kolla/kolla-ansible/tools/init-runonce

然后创建 net-1 和vm1,horizon拓扑图如下:
kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点_第1张图片
登录opencontrail界面信息

https://10.89.151.104:8143/ admin/contrail1
kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点_第2张图片
kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点_第3张图片

kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点_第4张图片

kolla快速集成openstack-ocata和opencontrail-4.0.1.0单节点_第5张图片

参考

[1] https://github.com/gokulpch/OpenContrail-Kolla.git

[2] https://gitlab.com/gokulpch/OpenContrail-Kolla/blob/master/README.md

[3] How to install Kolla Openstack Ocata and Open Contrail4.0-multinode http://nakadaisuke.blogspot.com/2017/

[4] opencontrail-hub https://hub.docker.com/u/opencontrail/

[5] gokulpch-hub https://hub.docker.com/u/gokulpch/

[6] kolla-hub https://hub.docker.com/u/kolla/

[7] 嵌套虚拟化 http://www.cnblogs.com/djoker/p/6393454.html

[8] 嵌套虚拟化 http://virtual.51cto.com/art/201412/460342.htm

[9] 安装指定版本的docker镜像 http://blog.csdn.net/csdn_duomaomao/article/details/73810752

本文衔接

你可能感兴趣的:(openstack,kolla,contrail)