目录

  1. 环境
    1. CentOS换源
    2. pip换源
    3. 网络配置
      1. nmcli
    4. 安装依赖
      1. 安装pip
      2. 安装python等依赖
      3. 安装ansible
    5. 安装kolla-ansible
      1. 设虚环境
      2. 源码安装
  2. 部署前配置
    1. 节点配置
      1. All-In-One
      2. Multinode
    2. 节点配置文件
      1. All-In-One
      2. Multinode
    3. 密码
    4. OpenStack配置文件
  3. 部署
    1. All-In-One
      1. 部署引导程序
      2. 部署检查
      3. 真正部署
      4. 销毁
    2. Multinode
      1. Docker Registry
      2. 部署引导程序
      3. 部署检查
      4. 真正部署
      5. 销毁
  4. 使用OpenStack
  5. 出错整理
    1. bootstrap-servers出错
    2. pull出错
      1. pull超时
      2. 镜像找不到
    3. deploy出错
      1. mariadb启动错误

环境

MacOS + Parallels Desktop + CentOS 7

CentOS换源

备份原文件

1
2
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

下载阿里云镜像源文件,并替换。

1
2
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

清除缓存

1
yum clean all

生成缓存

1
yum makecache

pip换源

1
2
mkdir .pip
vim .pip/pip.conf

pip.conf

1
2
3
4
5
6
7
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
use-mirros = true
mirrors = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

网络配置

  • Network 1(Shared)

    子网:172.88.0.0/24
    用途:用于虚拟机连接外网。

  • Network 2(Host Only)

    子网:10.88.88.0/24
    用途:管理网络,用作OpenStack内部网络。

  • Network 3(Host Only)

    子网:10.88.188.0/24
    用途:外部网络,用作OpenStack Floating IP使用的外网网卡。

nmcli

nmcli
nmcli是redhat7或者centos7之后的命令,该命令可以完成网卡上所有的配置工作,并且可以写入配置文件,永久生效。

查看所有设备。

1
nmcli d
所有设备所有设备

设置网卡一。

1
nmcli c modify eth0 ipv4.address 172.88.0.3/24

设置网卡二,静态IP。

1
2
nmcli c modify eth1 ipv4.address 10.88.88.3/24
nmcli c modify eth1 ipv4.method manual

设置网卡三,网卡三不需要设置IP。

1
nmcli c modify eth2 ipv4.method disabled

重启网络,激活配置。

1
systemctl restart network

不可为网卡一设置静态IP,不然会出现上不了外网的情况。
网卡三不能设置IP!!!
网卡三不能设置IP!!!
网卡三不能设置IP!!!

不想用命令行,可以使用nmtui命令进入NetworkManager TUI界面进行修改。

安装依赖

安装pip

1
2
3
yum install epel-release
yum install python-pip
pip install -U pip

安装python等依赖

1
yum install python-devel libffi-devel gcc openssl-devel libselinux-python

安装ansible

1
yum install ansible
1
pip install ansible == 2.4 

ansible版本过高部署时会出错。

配置ansible。

1
2
3
4
5
6
7
8
# /etc/ansible/ansible.cfg
[defaults]
# 关闭首次连接服务器验证
host_key_checking = False
# 打开ssh pipelining加速
pipelining = True
# 并发进程数
forks=100

安装kolla-ansible

设虚环境

1
2
3
pip install virtualenv
cd /opt && mkdir kolla-ansible && cd kolla-ansible
virtualenv virtualenv -p /usr/bin/python2.7

源码安装

源码安装。

1
2
3
4
5
git clone https://github.com/openstack/kolla-ansible
cd kolla-ansible
git checkout -b rocky remotes/origin/stable/rocky
/opt/kolla-ansible/virtualenv/bin/python setup.py install
/opt/kolla-ansible/virtualenv/bin/python -m pip install -r requirements.txt

添加别名

1
2
3
4
5
6
7
8
# /root/.zshrc

alias kolla-ansible="/opt/kolla-ansible/virtualenv/bin/kolla-ansible"
alias kolla-genpwd="/opt/kolla-ansible/virtualenv/bin/kolla-genpwd"
alias kolla-ansible-python="/opt/kolla-ansible/virtualenv/bin/python"
alias kolla-ansible-pip="/opt/kolla-ansible/virtualenv/bin/python -m pip"

source /root/.zshrc

安装完成后,使用pip命令查看一下kolla-ansible的版本

1
2
kolla-ansible-pip list | grep kolla
kolla-ansible 7.2.2.dev8

复制globals.yml和passwords.yml到/etc/kolla。

1
cp -r /root/kolla-ansible/etc/kolla /etc/

复制all-in-one和multinode到当前目录。

1
cp /root/kolla-ansible/ansible/inventory/* .

部署前配置

节点配置

All-In-One

CPU:2核
Memory:4G
OS:CentOS 7
网卡一(eth0):Network 1 IP:DHCP
网卡二(eth1):Network 2 IP:10.88.88.10/2
网卡三(eth2):Network 3 IP:无IP

1
2
3
4
5
6
7
8
9
10
11
        eth1|10.0.0.10 
+-----------+-----------+
| [ Control Node ] |
| |
| MariaDB RabbitMQ |
| Memcached httpd |
| Keystone Glance |
| Nova API,Compute |
| Neutron Server |
| L2,L3,Metadata Agent |
+-----------------------+

Multinode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
------------+---------------------------+---------------------------+------------
| | |
eth1|10.88.88.10 eth1|10.88.88.20 eth1|10.88.88.30
+-----------+-----------+ +-----------+-----------+ +-----------+-----------+
| [ Control Node ] | | [ Network Node ] | | [ Compute Node ] |
| | | | | |
| MariaDB RabbitMQ | | Open vSwitch | | Libvirt |
| Memcached httpd | | L2 Agent | | Nova Compute |
| Keystone Glance | | L3 Agent | | Open vSwitch |
| Nova API | | Metadata Agent | | L2 Agent |
| Neutron Server | | | | |
| Metadata Agent | | | | |
+-----------------------+ +-----------+-----------+ +-----------------------+
eth2|(UP with no IP)

节点配置文件

All-In-One

因为是部署all-in-one,所以all-in-one配置文件不需要做任何修改。

Multinode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[control]
10.88.88.10 ansible_ssh_user=root ansible_become=True

[network]
10.88.88.20 ansible_ssh_user=root ansible_become=True

[inner-compute]
10.88.88.30 ansible_ssh_user=root ansible_become=True

[external-compute]


[compute:children]
inner-compute
external-compute

[monitoring]
10.88.88.10 ansible_ssh_user=root ansible_become=True

[storage]
10.88.88.30 ansible_ssh_user=root ansible_become=True

[deployment]
localhost ansible_connection=local

密码

使用命令生成OpenStack组件的密码,文件位于/etc/kolla/passwords.yml。

1
kolla-genpwd

在/etc/kolla/passwords.yml找到keystone_admin_password,将它修改成你常用的密码。

1
keystone_admin_password: 199412

OpenStack配置文件

主要配置位于/etc/kolla/globals.yml。

我的配置文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# /etc/kolla/global.yaml

kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "rocky"

kolla_internal_vip_address: "10.88.88.88"
network_interface: "eth1"
neutron_external_interface: "eth2"
enable_chrony: "yes"
enable_horizon: "yes"
nova_compute_virt_type: "qemu"
nova_console: "spice"
neutron_plugin_agent: "openvswitch"

# All-In-One时可不加
docker_registry: 10.88.88.10:4000

字段解释。
镜像相关
kolla_base_distro
镜像系统版本,建议centos或者ubuntu。

kolla_install_type
可选binary:二进制镜像。
可选source:源代码镜像。

openstack_release
OpenStack的版本。

网络相关
network_interface
OpenStack管理网络的网卡。

neutron_external_interface
OpenStack外部网络使用的网卡,不能有IP。

kolla_internal_vip_address
高可用的虚拟的IP地址,为管理网络提供的一个Floating IP,和管理网络同网段且没有被占用。

nova_compute_virt_type
由于在虚拟机中部署OpenStack,不支持KVM,所以这里要改成qemu。

部署

All-In-One

部署引导程序

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one bootstrap-servers

部署检查

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one prechecks

真正部署

部署时需要从docker镜像仓库中拉取镜像,此步骤比较耗时,可以先将镜像拉至本地。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one pull

部署

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one deploy

销毁

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one destroy --yes-i-really-really-mean-it

Multinode

Docker Registry

这里先生成一个Docker的本地仓库。首先先用kolla-ansible命令将Openstack的相关镜像拉到本地。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one pull

启动Docker Registry容器。

1
2
3
4
5
6
7
docker run -d \
--name registry \
--restart=always \
-p 4000:5000 \
-v registry:/var/lib/registry \
registry:2

使用curl访问本地镜像仓库。

1
2
3
4
5
6
7
8
9
 curl -X GET http://10.88.88.10:4000/v2/_catalog | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1238 100 1238 0 0 6140 0 --:--:-- --:--:-- --:--:-- 6900

{
"repositories": []
}

把拉取到的镜像上传到本地仓库。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

registry_ip='10.88.88.10'
registry_port='4000'
openstack_version_tag='rocky'

images=$(docker images | grep -v registry | grep -v REPOSITORY | grep -v $registry_ip | awk '{print $1}')

for image in $images;
do
docker image tag $image:$openstack_version_tag $registry_ip:$registry_port/$image:$openstack_version_tag
done

images=$(docker images | grep $registry_ip | awk '{print $1}')

for image in $images;
do
docker push $image:$openstack_version_tag
#docker rmi -f $image:$openstack_version_tag
done

使用curl访问本地镜像仓库。

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
42
43
44
45
 curl -X GET http://10.88.88.10:4000/v2/_catalog | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1238 100 1238 0 0 60140 0 --:--:-- --:--:-- --:--:-- 61900

{
"repositories": [
"kolla/centos-source-chrony",
"kolla/centos-source-cron",
"kolla/centos-source-fluentd",
"kolla/centos-source-glance-api",
"kolla/centos-source-haproxy",
"kolla/centos-source-heat-api",
"kolla/centos-source-heat-api-cfn",
"kolla/centos-source-heat-engine",
"kolla/centos-source-horizon",
"kolla/centos-source-keepalived",
"kolla/centos-source-keystone",
"kolla/centos-source-keystone-fernet",
"kolla/centos-source-keystone-ssh",
"kolla/centos-source-kolla-toolbox",
"kolla/centos-source-mariadb",
"kolla/centos-source-memcached",
"kolla/centos-source-neutron-dhcp-agent",
"kolla/centos-source-neutron-l3-agent",
"kolla/centos-source-neutron-linuxbridge-agent",
"kolla/centos-source-neutron-metadata-agent",
"kolla/centos-source-neutron-openvswitch-agent",
"kolla/centos-source-neutron-server",
"kolla/centos-source-nova-api",
"kolla/centos-source-nova-compute",
"kolla/centos-source-nova-conductor",
"kolla/centos-source-nova-consoleauth",
"kolla/centos-source-nova-libvirt",
"kolla/centos-source-nova-placement-api",
"kolla/centos-source-nova-scheduler",
"kolla/centos-source-nova-spicehtml5proxy",
"kolla/centos-source-nova-ssh",
"kolla/centos-source-openvswitch-db-server",
"kolla/centos-source-openvswitch-vswitchd",
"kolla/centos-source-rabbitmq"
]
}

上传成功后,编辑/etc/kolla/globals.yml文件,添加。

1
docker_registry = 10.88.88.10:4000

执行部署引导程序。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode bootstrap-servers

查看每个节点上的/etc/systemd/system/docker.service.d/kolla.conf文件应该和下面一致。

1
2
3
[Service]
MountFlags=shared
ExecStart=/usr/bin/dockerd --insecure-registry 10.88.88.10:4000 --log-opt max-file=5 --log-opt max-size=50m

将镜像仓库中的镜像拉取到每一个节点上。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode pull

查看镜像列表。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 网络节点
docker images

REPOSITORY TAG IMAGE ID CREATED SIZE
10.88.88.10:4000/kolla/centos-source-neutron-linuxbridge-agent rocky 91c3147f334a 3 months ago 1.17GB
10.88.88.10:4000/kolla/centos-source-neutron-metadata-agent rocky 93bfc32c90be 3 months ago 1.14GB
10.88.88.10:4000/kolla/centos-source-neutron-openvswitch-agent rocky e62d9136aeff 3 months ago 1.14GB
10.88.88.10:4000/kolla/centos-source-neutron-l3-agent rocky b8b4d7cdc637 3 months ago 1.17GB
10.88.88.10:4000/kolla/centos-source-neutron-dhcp-agent rocky 08fbe6e215c3 3 months ago 1.14GB
10.88.88.10:4000/kolla/centos-source-cron rocky 93f91f08261d 3 months ago 452MB
10.88.88.10:4000/kolla/centos-source-openvswitch-vswitchd rocky 3a404d3f0b6d 3 months ago 492MB
10.88.88.10:4000/kolla/centos-source-openvswitch-db-server rocky 6ce2892e744f 3 months ago 492MB
10.88.88.10:4000/kolla/centos-source-kolla-toolbox rocky 70beff5a1cba 3 months ago 749MB
10.88.88.10:4000/kolla/centos-source-haproxy rocky 812b6786a74d 3 months ago 477MB
10.88.88.10:4000/kolla/centos-source-fluentd rocky 99ac3e878eac 3 months ago 586MB
10.88.88.10:4000/kolla/centos-source-chrony rocky a311eb23d70a 3 months ago 453MB
10.88.88.10:4000/kolla/centos-source-keepalived rocky 4f6014abefd0 3 months ago 462MB

部署引导程序

在创建Docker镜像仓库时已经完成,可以略过。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode bootstrap-servers

部署检查

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode prechecks

真正部署

在创建Docker镜像仓库时已经完成,可以略过。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode pull

部署

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./multinode deploy

销毁

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible -i ./all-in-one destroy --yes-i-really-really-mean-it

使用OpenStack

安装OpenStack命令行包。

1
pip install python-openstackclient python-glanceclient python-neutronclient

生成admin-openrc文件,生成后的admin-openrc.sh位于/ect/kolla/下。

1
2
source /opt/kolla-ansible/virtualenv/bin/activate
kolla-ansible post-deploy
1
source /etc/kolla/admin-openrc.sh

kolla-ansible中还带有一次初始化的工具。

1
. /root/kolla-ansible/tools/init-runonce

创建虚拟机。

1
openstack server create --image cirros --flavor m1.tiny --key-name mykey --network demo-net demo1

出错整理

bootstrap-servers出错

1
2
3
4
5
6
7
8
TASK [baremetal : Install apt packages] ***********************************************************************************************************************
task path: /usr/share/kolla-ansible/ansible/roles/baremetal/tasks/install.yml:46
fatal: [localhost]: FAILED! => {
"msg": "An unhandled exception occurred while templating '[u'{{ docker_apt_package }}', u'git', u'{% if not easy_install_available %}python-pip{% endif %}', u'python-setuptools', u'{% if enable_host_ntp | bool %}ntp{% endif %}', u'{% if enable_ceph_nfs|bool %}rpcbind{% endif %}']'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ ansible_distribution != 'Ubuntu' or\n ansible_distribution_major_version | version_compare(18, 'lt') }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no filter named 'version_compare'. String: {{ ansible_distribution != 'Ubuntu' or\n ansible_distribution_major_version | version_compare(18, 'lt') }}"
}



pull出错

pull超时

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
TASK [placement : Pulling placement images] *******************************************************************************************************************
task path: /usr/share/kolla-ansible/ansible/roles/placement/tasks/pull.yml:2
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419 && echo ansible-tmp-1592558256.52-14167-175147722269419="` echo /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419 `" ) && sleep 0'
Using module file /usr/share/kolla-ansible/ansible/library/kolla_docker.py
<localhost> PUT /root/.ansible/tmp/ansible-local-12855YYid72/tmpWIiQl1 TO /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419/AnsiballZ_kolla_docker.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419/ /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419/AnsiballZ_kolla_docker.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419/AnsiballZ_kolla_docker.py && sleep 0'



<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592558256.52-14167-175147722269419/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_kolla_docker_payload_ztPmIS/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py", line 1024, in main
File "/tmp/ansible_kolla_docker_payload_ztPmIS/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py", line 571, in pull_image
File "/usr/lib/python2.7/site-packages/docker/api/image.py", line 415, in pull
self._raise_for_status(response)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
failed: [localhost] (item={'value': {u'haproxy': {u'placement_api_external': {u'mode': u'http', u'enabled': True, u'external': True, u'listen_port': u'8780', u'port': u'8780'}, u'placement_api': {u'mode': u'http', u'enabled': True, u'external': False, u'listen_port': u'8780', u'port': u'8780'}}, u'group': u'placement-api', u'dimensions': {}, u'volumes': [u'/etc/kolla/placement-api/:/var/lib/kolla/config_files/:ro', u'/etc/localtime:/etc/localtime:ro', u'', u'kolla_logs:/var/log/kolla/', u''], u'container_name': u'placement_api', u'image': u'kolla/centos-source-placement-api:rocky', u'enabled': True}, 'key': u'placement-api'}) => {
"ansible_loop_var": "item",
"changed": true,
"invocation": {
"module_args": {
"action": "pull_image",
"api_version": "auto",
"auth_email": null,
"auth_password": null,
"auth_registry": null,
"auth_username": null,
"cap_add": [],
"client_timeout": 120,
"command": null,
"detach": true,
"dimensions": {},
"environment": {
"KOLLA_CONFIG_STRATEGY": "COPY_ALWAYS"
},
"graceful_timeout": 10,
"image": "kolla/centos-source-placement-api:rocky",
"labels": {},
"name": null,
"privileged": false,
"remove_on_exit": true,
"restart_policy": "unless-stopped",
"restart_retries": 10,
"security_opt": [],
"state": "running",
"tls_cacert": null,
"tls_cert": null,
"tls_key": null,
"tls_verify": false,
"tty": false,
"volumes": null,
"volumes_from": null
}
},
"item": {
"key": "placement-api",
"value": {
"container_name": "placement_api",
"dimensions": {},
"enabled": true,
"group": "placement-api",
"haproxy": {
"placement_api": {
"enabled": true,
"external": false,
"listen_port": "8780",
"mode": "http",
"port": "8780"
},
"placement_api_external": {
"enabled": true,
"external": true,
"listen_port": "8780",
"mode": "http",
"port": "8780"
}
},
"image": "kolla/centos-source-placement-api:rocky",
"volumes": [
"/etc/kolla/placement-api/:/var/lib/kolla/config_files/:ro",
"/etc/localtime:/etc/localtime:ro",
"",
"kolla_logs:/var/log/kolla/",
""
]
}
},
"msg": "'Traceback (most recent call last):\\n File \"/tmp/ansible_kolla_docker_payload_ztPmIS/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py\", line 1024, in main\\n File \"/tmp/ansible_kolla_docker_payload_ztPmIS/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py\", line 571, in pull_image\\n File \"/usr/lib/python2.7/site-packages/docker/api/image.py\", line 415, in pull\\n self._raise_for_status(response)\\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 263, in _raise_for_status\\n raise create_api_error_from_http_exception(e)\\n File \"/usr/lib/python2.7/site-packages/docker/errors.py\", line 31, in create_api_error_from_http_exception\\n raise cls(e, response=response, explanation=explanation)\\nAPIError: 500 Server Error: Internal Server Error (\"Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 172.88.0.1:53: read udp 172.88.0.3:34546->172.88.0.1:53: i/o timeout\")\\n'"
}

拉取镜像超时,可以配置docker镜像加速器。

镜像找不到

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
TASK [placement : Pulling placement images] *******************************************************************************************************************
task path: /usr/share/kolla-ansible/ansible/roles/placement/tasks/pull.yml:2
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375 && echo ansible-tmp-1592558605.61-15468-139107170430375="` echo /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375 `" ) && sleep 0'
Using module file /usr/share/kolla-ansible/ansible/library/kolla_docker.py
<localhost> PUT /root/.ansible/tmp/ansible-local-148157iZlQ7/tmp_iUgbJ TO /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375/AnsiballZ_kolla_docker.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375/ /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375/AnsiballZ_kolla_docker.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375/AnsiballZ_kolla_docker.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592558605.61-15468-139107170430375/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_kolla_docker_payload_gMkBSM/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py", line 1024, in main
File "/tmp/ansible_kolla_docker_payload_gMkBSM/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py", line 571, in pull_image
File "/usr/lib/python2.7/site-packages/docker/api/image.py", line 415, in pull
self._raise_for_status(response)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
failed: [localhost] (item={'value': {u'haproxy': {u'placement_api_external': {u'mode': u'http', u'enabled': True, u'external': True, u'listen_port': u'8780', u'port': u'8780'}, u'placement_api': {u'mode': u'http', u'enabled': True, u'external': False, u'listen_port': u'8780', u'port': u'8780'}}, u'group': u'placement-api', u'dimensions': {}, u'volumes': [u'/etc/kolla/placement-api/:/var/lib/kolla/config_files/:ro', u'/etc/localtime:/etc/localtime:ro', u'', u'kolla_logs:/var/log/kolla/', u''], u'container_name': u'placement_api', u'image': u'kolla/centos-source-placement-api:rocky', u'enabled': True}, 'key': u'placement-api'}) => {
"ansible_loop_var": "item",
"changed": true,
"invocation": {
"module_args": {
"action": "pull_image",
"api_version": "auto",
"auth_email": null,
"auth_password": null,
"auth_registry": null,
"auth_username": null,
"cap_add": [],
"client_timeout": 120,
"command": null,
"detach": true,
"dimensions": {},
"environment": {
"KOLLA_CONFIG_STRATEGY": "COPY_ALWAYS"
},
"graceful_timeout": 10,
"image": "kolla/centos-source-placement-api:rocky",
"labels": {},
"name": null,
"privileged": false,
"remove_on_exit": true,
"restart_policy": "unless-stopped",
"restart_retries": 10,
"security_opt": [],
"state": "running",
"tls_cacert": null,
"tls_cert": null,
"tls_key": null,
"tls_verify": false,
"tty": false,
"volumes": null,
"volumes_from": null
}
},
"item": {
"key": "placement-api",
"value": {
"container_name": "placement_api",
"dimensions": {},
"enabled": true,
"group": "placement-api",
"haproxy": {
"placement_api": {
"enabled": true,
"external": false,
"listen_port": "8780",
"mode": "http",
"port": "8780"
},
"placement_api_external": {
"enabled": true,
"external": true,
"listen_port": "8780",
"mode": "http",
"port": "8780"
}
},
"image": "kolla/centos-source-placement-api:rocky",
"volumes": [
"/etc/kolla/placement-api/:/var/lib/kolla/config_files/:ro",
"/etc/localtime:/etc/localtime:ro",
"",
"kolla_logs:/var/log/kolla/",
""
]
}
},
"msg": "'Traceback (most recent call last):\\n File \"/tmp/ansible_kolla_docker_payload_gMkBSM/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py\", line 1024, in main\\n File \"/tmp/ansible_kolla_docker_payload_gMkBSM/ansible_kolla_docker_payload.zip/ansible/modules/kolla_docker.py\", line 571, in pull_image\\n File \"/usr/lib/python2.7/site-packages/docker/api/image.py\", line 415, in pull\\n self._raise_for_status(response)\\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 263, in _raise_for_status\\n raise create_api_error_from_http_exception(e)\\n File \"/usr/lib/python2.7/site-packages/docker/errors.py\", line 31, in create_api_error_from_http_exception\\n raise cls(e, response=response, explanation=explanation)\\nNotFound: 404 Client Error: Not Found (\"manifest for kolla/centos-source-placement-api:rocky not found: manifest unknown: manifest unknown\")\\n'"
}

在Rocky版本中placement-api是nova组件的一部分,kolla-ansible版本过高导致的。

原因

1
2
3
4
# /usr/share/kolla-ansible/ansible/roles/placement/defaults/main.yml

placement_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ placement_install_type }}-nova- placement-api"

deploy出错

1
2
3
4
5
TASK [mariadb : Writing hostname of host with existing cluster files to temp file] ****************************************************************************
task path: /opt/kolla-ansible/virtualenv/share/kolla-ansible/ansible/roles/mariadb/tasks/lookup_cluster.yml:22
fatal: [localhost]: FAILED! => {
"msg": "The conditional check 'not mariadb_volume | changed' failed. The error was: template error while templating string: no filter named 'changed'. String: {% if not mariadb_volume | changed %} True {% else %} False {% endif %}\n\nThe error appears to be in '/opt/kolla-ansible/virtualenv/share/kolla-ansible/ansible/roles/mariadb/tasks/lookup_cluster.yml': line 22, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Writing hostname of host with existing cluster files to temp file\n ^ here\n"
}

原因

1
Since Ansible 2.5, the use of jinja tests as filters has been deprecated.

方案一:
安装ansbile时,需要指定版本2.4.0。

方案二:
修改

1
2
3
4
5
6
# /opt/kolla-ansible/virtualenv/share/kolla-ansible/ansible/roles/mariadb/tasks/lookup_cluster.yml
- name: Writing hostname of host with existing cluster files to temp file
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644
changed_when: False
check_mode: no
when: not mariadb_volume | changed
1
2
3
4
5
6
# /opt/kolla-ansible/virtualenv/share/kolla-ansible/ansible/roles/mariadb/tasks/lookup_cluster.yml
- name: Writing hostname of host with existing cluster files to temp file
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644
changed_when: False
check_mode: no
when: mariadb_volume is not changed

mariadb启动错误

1
InnoDB: Cannot allocate memory for the buffer pool