openstack单节点环境搭建

本文记录在安装openstack单节点环境时踩过的一些坑

搭建环境

搭建方式

因为kolla比DevStack等方式要新一些,故最终选用kolla来安装。而kolla又分下面两种

  • kolla-kubernetes (不如ansible成熟)
  • kolla-ansible

只是入门,就选择使用单点部署

系统环境

ubuntu 14.04 安装测试

步骤

主要根据参考中的官方文档来搭的环境,需要注意的是,kolla-ansible和kolla两个项目切到origin/stable/queens等稳定版本

根据文档安装完成后,可以登陆Horizon dashboard、访问nova等api接口,但是创建虚机还是会报错,留作后面再排错。

遇到的问题

  1. build image卡住没有进度

    1
    2
    3
    解决方法:添加docker源
    /etc/docker/daemon.json
    {"registry-mirrors": ["https://a5aghnme.mirror.aliyuncs.com"]}
  2. 报错

    1
    ERROR:kolla.common.utils.base:The command '/bin/sh -c yum -y install centos-release-ceph-luminous centos-release-opstools centos-release-qemu-ev epel-release yum-plugin-priorities && yum clean all && rm -rf /var/cache/yum' returned a non-zero code: 1
  3. docker-engine和docker.io冲突

    1
    2
    解决方法:卸载docker.io
    yum remove docker.io docker-common
  4. 找不到镜像

    1
    2
    3
    4
    5
    6
    Tag 7.0.0 not found in repository docker.io/kolla/centos-binary-cron

    解决方法:修改globals.yml中的配置指定tag

    Dockerhub images are tagged as pike, master, etc. Please set:
    openstack_release: "pike" in your globals.yml
  5. 报错

    1
    2
    3
    4
    Error starting daemon: error initializing graphdriver: \"/var/lib/docker\" contains several valid graphdrivers: devicemapper, overlay; Please cleanup or explicitly choose storage driver (-s <DRIVER>)
    到/var/lib/docker根据情况,将下面的overlay或者devicemapper文件夹删掉即可。这种情况发生在使用采用dc/os安装后,原有的devicemapper模式修改成了overlay,但是docker同时只能支持一种存储模式。

    不能删除/var/lib/docker/devicemapper 提示device busy时,可以umount /var/lib/docker/devicemapper后再删除
  6. Kolla-build: command not found

    1
    pip install ./kolla
  7. 报错

    1
    https://packagecloud.io/grafana/stable/el/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 302 - Found
  8. docker python库报错

    1
    2
    3
    4
    load_config() got an unexpected keyword argument

    解决方法:不要按照官方文档安装python-docker-py
    pip install 'docker>=2.6,<3.0.0'
  9. 报错

    1
    2
    3
    4
    5
    6
    pip install ./kolla时报错
    Failed to fetch https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/dists/xenial/InRelease Unable to connect to packagecloud-repositories.s3.dualstack.us-west-1.amazonaws.com:https:
    INFO:kolla.common.utils.zookeeper:W: Some index files failed to download. They have been ignored, or old ones used instead.

    解决办法:
    pip install ./kolla --ignore-installed PyYAML
  10. pip依赖不能重装

    1
    Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
  11. 部署中报错

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    问题:
    The conditional check 'config_json.changed | bool or rabbitmq_confs.changed

    解决办法:kolla和kolla-ansible 都切到stable版本

    问题:
    fatal: [localhost]: FAILED! => {"msg": "Unable to look up a name or access an attribute in template string ({{ inventory_hostname in groups['neutron-metering-agent'] }}).\nMake sure your variable name does not contain invalid characters like '-': argument of type 'StrictUndefined' is not iterable"}

    解决办法:
    直接禁用haproxy

    问题:
    failed: [localhost] (item=/usr/share/kolla-ansible/ansible/roles/haproxy/templates/haproxy.cfg.j2) => {"changed": false, "item": "/usr/share/kolla-ansible/ansible/roles/haproxy/templates/haproxy.cfg.j2", "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'glance-registry'"}

    解决办法:直接禁用haproxy
    enable_haproxy: "no"

    问题:
    rabbitmq_monitoring_password' is undefined"

    问题:
    .docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.0.2:53: read udp 192.168.0.10:48758->192.168.0.2:53: i/o timeout\")\\n'"}

    解决办法:
    修改/etc/hosts添加dns服务器:nameserver 8.8.8.8

    问题:
    只有一张物理网卡

    解决办法:
    ifconfig创建一个虚拟网卡
    ifconfig eth0:0 192.168.10.10 up

    问题:
    docker需要认证

    解决办法:
    docker login命令先登陆

    问题:
    TASK [neutron : Running Neutron bootstrap container] *************************** 卡住了
  12. 部署前检查报错

    1
    fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["ip", "-4", "-o", "addr", "show", "dev", "eth0"], "delta": "0:00:00.043125", "end": "2019-01-10 13:48:41.975511", "failed_when_result": true, "rc": 0, "start": "2019-01-10 13:48:41.932386", "stderr": "", "stderr_lines": [], "stdout": "2: eth0    inet 192.168.16.88/20 brd 192.168.31.255 scope global noprefixroute eth0\\       valid_lft forever preferred_lft forever", "stdout_lines": ["2: eth0    inet 192.168.16.88/20 brd 192.168.31.255 scope global noprefixroute eth0\\       valid_lft forever preferred_lft forever"]}
  13. 登陆dabashboard提示证书不可用

    1
    2
    3
    原因:账号密码不正确

    账号默认是admin,密码在cat /etc/kolla/passwords.yml|grep -i keystone_admin

tips

  1. kolla-ansible和kolla项目切到稳定分支
  2. 如果在virtualbox中安装时,centos7镜像选择minimal。dvd版 4G+太大了
  3. 没有双网卡可以使用ifconfig虚拟一张网卡

参考

Kolla 让 OpenStack 部署更贴心

Docker 容器化部署运维 OpenStack 和 Ceph

官方文档