如何在OpenStack Kolla上部署Tungsten Fabric(附14个常见的配置问题)

it2023-05-30  73

首先,使用contil-kolla-ansible-deployer容器在OpenStack Kolla上部署Tungsten Fabric(注:原文为Contrail,本文以功能一致的Tungsten Fabric替换):

更多详细信息,请关注TF中文社区

无论是使用contil-kolla-ansible部署kolla容器,或者使用contrail-ansible-deployer部署Tungsten Fabric容器,都涉及以下主要步骤:

1.设置基本主机 2.部署OpenStack(kolla)和Tungsten Fabric容器

1. 设置基本主机

下面给出的步骤假定是在内核为3.10.0-862.3.2.el7.x86_64.的Centos 7.5基本主机上。vRouter与主机内核具有依赖性。

1.0安装必备软件包

yum -y install epel-release yum install -y python-pip pip install requests

1.1 安装Ansible

yum -y install git pip install ansible==2.5.2.0

1.2 克隆contrail-ansible-deployer

git clone http://github.com/Juniper/contrail-ansible-deployer cd contrail-ansible-deployer

1.3 在适当的参数下配置必要的参数config/instances.yaml

这是单节点、单接口的多合一集群的最低配置。

对于多接口设置,请参考以下链接获取推荐的配置:

更多详细信息,请关注TF中文社区

provider_config: bms: ssh_pwd: ssh_user: root ntpserver: domainsuffix: local instances: : provider: bms ip: roles: config_database: config: control: analytics_database: analytics: webui: vrouter: openstack: openstack_compute: contrail_configuration: AUTH_MODE: keystone KEYSTONE_AUTH_URL_VERSION: /v3 kolla_config: kolla_globals: enable_haproxy: no enable_ironic: "no" enable_swift: "no" kolla_passwords: keystone_admin_password:

这里是一个用于类似多合一单节点的文件,用于解释目的。

provider_config: bms: ssh_pwd: ssh_user: root ntpserver: domainsuffix: local instances: : provider: bms ip: roles: config_database: config: control: analytics_database: analytics: webui: vrouter: openstack: openstack_compute: global_configuration: CONTAINER_REGISTRY: : REGISTRY_PRIVATE_INSECURE: True CONTAINER_REGISTRY_USERNAME: CONTAINER_REGISTRY_PASSWORD: contrail_configuration: CLOUD_ORCHESTRATOR: openstack # Default value for OPENSTACK_VERSION is 'queens' OPENSTACK_VERSION: ocata # Default value for CONTRAIL_VERSION is 'latest'. The version must be available in # registry specified in CONTAINER_REGISTRY CONTRAIL_VERSION: 5.0-198 # Set UPGRADE_KERNEL to True to automatically install the latest kernel version UPGRADE_KERNEL: True CONTRAIL_VERSION: # Ex: latest or any private-repo containers tag. VROUTER_GATEWAY: AUTH_MODE: keystone KEYSTONE_AUTH_URL_VERSION: /v3 kolla_config: kolla_globals: enable_haproxy: no enable_ironic: no enable_swift: no kolla_passwords: keystone_admin_password:

这里有一些提示:

a、Provider configuration是指Tungsten Fabric集群主机所在的云服务商。对于裸机服务器,provide将为“bms”。

b、有关此文件字段的更多详细信息,请关注TF中文社区。

c、更多详细信息,请关注TF中文社区,以了解在OpenStack服务的“ kolla_globals”部分和Tungsten Fabric服务的“ contrail_configuration”部分可以自定义哪些字段:

Kolla全局档案更多Kolla配置Tungsten Fabric配置参数

d、如果您要构建自己的容器,则可以将CONTAINER_REGISTRY设置为本地Docker注册表。如果未指定,它将尝试从docker hub中拉取容器。如果指定了自定义注册表,请注意,您必须在kolla_globals下指定与“contrail_docker_registry”相同的注册表。目前暂时不会自动导出,将在以后的代码更改中完成。

e、如果未指定,则CONTRAIL_VERSION将默认为“latest”标签。如果您喜欢nightly build的特定版本,更多详细信息,请关注TF中文社区。

f、其它场景的样本配置(更多详细信息,请关注TF中文社区)

多节点多接口配置多节点单接口配置

g、如果需要为每个主机指定特定于主机的值(例如,如果集群中的服务器上用于“network_interface”的接口名称不同),更多详细信息,请关注TF中文社区

h、许多参数会自动导出为默认设置,这是第一种配置的工作方式。如果需要,用户可以显式指定变量以覆盖派生的值。如果您想了解派生逻辑,请查看代码。

i、如果您希望在多合一节点上配置Tungsten Fabric + OpenStack,并且所有服务都侦听私有子网IP地址(非mgmt),请按以下方式配置OpenStack:

openstack: kolla_internal_address: 192.168.10.10 network_interface: eth2

如果不需要限制仅访问该子网,则在kolla_globals部分下将“enable_haproxy”设置为“yes”就足够了。

1.4安装Tungsten Fabric和Kolla要求

以下Playbook将软件包安装在部署程序主机以及启动Kolla和Tungsten Fabric容器所需的目标主机上。

ansible-playbook -i inventory/ -e orchestrator=openstack playbooks/configure_instances.yml

2. 配置Tungsten Fabric和Kolla容器

ansible-playbook -i inventory/ playbooks/install_openstack.yml ansible-playbook -i inventory/ -e orchestrator=openstack playbooks/install_contrail.yml

3. 运行OpenStack命令

3.1 安装OpenStack客户端

由于kolla_toolbox容器已经安装了客户端,因此无需安装OpenStack客户端。更多详细信息,请关注TF中文社区。

或者,如果您希望从基本主机上运行命令,请遵循以下说明。

OpenStack客户端以前是作为Playbook运行的一部分自动安装的。但是在安装python docker组件库时引入了一些必要的python库,这些库现在与从Yum repos中安装python-openstackclients相冲突。获取python-openstackclient软件包的另一个选项是通过“pip”repos进行安装。但是安装这些pip软件包可能会导致Ansible可执行文件崩溃,因为Ansible使用的库也会发生变化。因此,需要使用pip手动安装客户端。

yum install -y gcc python-devel pip install python-openstackclient pip install python-ironicclient

3.2 使用VM到VM ping测试您的设置

source /etc/kolla/kolla-toolbox/admin-openrc.sh wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img openstack image create cirros2 --disk-format qcow2 --public --container-format bare --file cirros-0.4.0-x86_64-disk.img openstack network create testvn openstack subnet create --subnet-range 192.168.100.0/24 --network testvn subnet1 openstack flavor create --ram 512 --disk 1 --vcpus 1 m1.tiny NET_ID=`openstack network list | grep testvn | awk -F '|' '{print $2}' | tr -d ' '` openstack server create --flavor m1.tiny --image cirros2 --nic net-id=${NET_ID} test_vm1 openstack server create --flavor m1.tiny --image cirros2 --nic net-id=${NET_ID} test_vm2

附:14个常见的配置问题

检查配置的常见问题以及修补程序/解决方法。

1. 找不到Kolla的文件/目录:

[root@a6s14 contrail-ansible-deployer]# ansible-playbook -i inventory/ -e orchestrator=vcenter playbooks/install_openstack.yml ... ... ERROR! Unable to retrieve file contents Could not find or access '/root/contrail-kolla-ansible/ansible/kolla-host.yml' [root@a6s14 contrail-ansible-deployer]#

解决方法:在运行install_contrail之前,请先运行以下命令:

ansible-playbook -i inventory/ playbooks/configure_instances.yml

2. 在Ansible中缺少IPv4:

TASK [memcached : Copying over config.json files for services] ******************************************************************************************************************************* task path: /root/contrail-kolla-ansible/ansible/roles/memcached/tasks/config.yml:10 failed: [192.168.122.84] (item=memcached) => { "changed": false, "item": "memcached", "msg": "AnsibleUndefinedVariable: {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] if orchestration_engine == 'ANSIBLE' else '0.0.0.0' }}: 'dict object' has no attribute 'ipv4'" }

解决方法:检查是否在instances.yaml文件的“kolla_globals”部分下为“network_interface”指定了正确的值。该接口必须具有一个IP地址。

3. 如何指定特定于主机的参数(例如,集群中不同服务器的接口名称不同)?

解决方法:更多详细信息,请关注TF中文社区。

4. 不能通过指定为“CONTAINER_REGISTRY”的专用注册表访问(拉取)容器。

解决方法:检查“REGISTRY_PRIVATE_INSECURE”是否设置为True。

更多详细信息,请关注TF中文社区。

5. vRouter模块未安装在计算机上。vRouter容器处于错误状态,并且docker日志显示如下错误:

[srvr5] ~ # docker logs vrouter_vrouter-kernel-init_1 insmod: ERROR: could not insert module /opt/contrail/vrouter-kernel-modules/???/vrouter.ko: Unknown symbol in module ERROR: Failed to insert vrouter kernel module

或像这样dmesg的日志如下:

[161758.854712] entrypoint.sh (19521): drop_caches: 2 [161758.861953] vrouter: Unknown symbol __x86_indirect_thunk_r15 (err 0) [161758.862025] vrouter: Unknown symbol __x86_indirect_thunk_r11 (err 0) [161758.862043] vrouter: Unknown symbol __x86_indirect_thunk_rax (err 0) [161758.862047] vrouter: disagrees about version of symbol napi_complete_done [161758.862049] vrouter: Unknown symbol napi_complete_done (err -22) [161758.862113] vrouter: Unknown symbol __x86_indirect_thunk_rdx (err 0) [161758.862158] vrouter: Unknown symbol __x86_indirect_thunk_r14 (err 0) [161758.862203] vrouter: Unknown symbol __x86_indirect_thunk_r13 (err 0) [161758.862216] vrouter: disagrees about version of symbol __ethtool_get_link_ksettings [161758.862218] vrouter: Unknown symbol __ethtool_get_link_ksettings (err -22) [161758.862240] vrouter: Unknown symbol __x86_indirect_thunk_r10 (err 0) [161758.862287] vrouter: Unknown symbol ether_setup_rh (err 0) [161758.862306] vrouter: Unknown symbol __x86_indirect_thunk_rcx (err 0) [161758.862327] vrouter: Unknown symbol __x86_indirect_thunk_r9 (err 0) [161758.862358] vrouter: Unknown symbol __x86_indirect_thunk_r12 (err 0) [161758.862381] vrouter: Unknown symbol napi_schedule_prep (err 0) [161758.862444] vrouter: Unknown symbol genl_register_family (err 0) [161758.862467] vrouter: Unknown symbol __x86_indirect_thunk_r8 (err 0)

解决方法:vRouter模块现在依赖于内核为3.10.0-862.3.2.el7.x86_64.的主机上。在运行配置之前,请在目标节点上安装此内核版本:

yum -y install kernel-3.10.0-862.3.2.el7.x86_64 yum update reboot

您也可以只更新到最新的内核-它应该可以工作。还有一个选择是让contrail-ansible-deployer更新您的内核:

contrail_configuration: UPGRADE_KERNEL: true

6. 检索容器映像时出错:

fatal: [10.87.70.19]: FAILED! => {“changed”: true, “msg”: “’Traceback (most recent call last): File \“/tmp/ansible_x7Zn20/ansible_module_kolla_docker.py\“, line 785, in main\\n result = bool(getattr(dw, module.params.get(\\‘action\\‘))())\\n File \“/tmp/ansible_x7Zn20/ansible_module_kolla_docker.py\“, line 583, in recreate_or_restart_container\\n self.start_container()\\n File \“/tmp/ansible_x7Zn20/ansible_module_kolla_docker.py\“, line 595, in start_container\\n self.pull_image()\\n File \“/tmp/ansible_x7Zn20/ansible_module_kolla_docker.py\“, line 445, in pull_image\\n repository=image, tag=tag, stream=True\\n File \“/usr/lib/python2.7/site-packages/docker/api/image.py\“, line 175, in pull\\n self._raise_for_status(response)\\n File \“/usr/lib/python2.7/site-packages/docker/client.py\“, line 173, in _raise_for_status\\n raise errors.NotFound(e, response, explanation=explanation)\\nNotFound: 404 Client Error: Not Found (\“{\“message\“:\“manifest for opencontrailnightly/contrail-openstack-ironic-notification-manager:master-centos7-ocata-bld-33 not found\“}\“)\\n’“} to retry, use: --limit @/root/contrail-ansible-deployer/playbooks/install_contrail.retry

解决方法:检查CONTRAIL_VERSION。它应该具有在此处找到的有效标签:opencontrailnightly标签

更多详细信息,请关注TF中文社区。

7. 看到此如下错误:

2018-03-21 00:47:16,884 p=16999 u=root | TASK [iscsi : Ensuring config directories exist] ********************************************************************************************************************************* 2018-03-21 00:47:16,959 p=16999 u=root | fatal: [10.0.0.4]: FAILED! => {"msg": "The conditional check 'inventory_hostname in groups['compute'] or inventory_hostname in groups['storage']' failed. The error was: error while evaluating conditional (inventory_hostname in groups['compute'] or inventory_hostname in groups['storage']): Unable to look up a name or access an attribute in template string ({% if inventory_hostname in groups['compute'] or inventory_hostname in groups['storage'] %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like '-': argument of type 'StrictUndefined' is not iterable\n\nThe error appears to have been in '/root/contrail-kolla-ansible/ansible/roles/iscsi/tasks/config.yml': line 2, 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: Ensuring config directories exist\n ^ here\n"} 2018-03-21 00:47:16,961 p=16999 u=root | to retry, use: --limit @/root/contrail-ansible-deployer/playbooks/install_contrail.retry

解决方法:这是通过Bug#1756133进行的最近更改的结果。在一个用例中,需要在没有nova-compute的情况下配置vRouter。因此,当指定“vrouter”角色时,不会自动推断出“openstack_compute”。需要与“vrouter”一起明确声明“openstack_compute”角色。

8. 为什么在单个OpenStack集群上需要haproxy和虚拟IP?

默认情况下,所有OpenStack服务都将侦听“kolla_globals”部分下的kolla_internal_vip_address/network_interface变量提供的IP/接口。在大多数情况下,这将对应于ctrl-data-network。请注意,这意味着即使horizon现在也只能在ctrl-data-network上运行。kolla提供访问管理网络上horizon的唯一方法是使用haproxy和keepalived。依次启用keepalived意味着VRRP需要虚拟IP,而虚拟IP不能是接口IP本身。如果不使用kolla配置参数启用keepalived,则无法启用haproxy。因此,您需要提供两个虚拟IP地址,一个在management上(kolla_external_vip_address),一个在ctrl-data-network上(kolla_internal_vip_address)。一旦指定了此范围,即可通过kolla_external_vip_address在管理网络上访问Horizon。

9. 如何使用kolla_toolbox容器运行OpenStack CLI命令

安装了运行OpenStack容器的基本主机的/etc/kolla/kolla-toolbox目录,并且可以从kolla_toolbox容器内部以/var/lib/kolla/config_files对其进行访问。如果用户在执行OpenStack命令时需要其它文件(例如“openstack image create”将需要映像文件),则用户可以将相关文件复制到基本主机的/etc/kolla/kolla-toolbox目录中,然后在容器内使用它们。运行OpenStack命令的方式如下:

# ON BASE HOST OF OPENSTACK CONTROL NODE cd /etc/kolla/kolla-toolbox wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img docker exec -it kolla_toolbox bash # NOW YOU ARE INSIDE THE KOLLA_TOOLBOX CONTAINER (kolla-toolbox)[ansible@server1 /]$ source /var/lib/kolla/config_files/admin-openrc.sh (kolla-toolbox)[ansible@server1 /]$ cd /var/lib/kolla/config_files (kolla-toolbox)[ansible@server1 /var/lib/kolla/config_files]$ openstack image create cirros2 --disk-format qcow2 --public --container-format bare --file cirros-0.4.0-x86_64-disk.img +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | 443b7623e27ecf03dc9e01ee93f67afe | | container_format | bare | | created_at | 2018-03-29T21:37:48Z | | disk_format | qcow2 | | file | /v2/images/e672b536-0796-47b3-83a6-df48a5d074be/file | | id | e672b536-0796-47b3-83a6-df48a5d074be | | min_disk | 0 | | min_ram | 0 | | name | cirros2 | | owner | 371bdb766278484bbabf868cf7325d4c | | protected | False | | schema | /v2/schemas/image | | size | 12716032 | | status | active | | tags | | | updated_at | 2018-03-29T21:37:50Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+ (kolla-toolbox)[ansible@server1 /var/lib/kolla/config_files]$ openstack image list +--------------------------------------+---------+--------+ | ID | Name | Status | +--------------------------------------+---------+--------+ | e672b536-0796-47b3-83a6-df48a5d074be | cirros2 | active | | 57e6620e-796a-40ee-ae6e-ea1daa253b6c | cirros2 | active | +--------------------------------------+---------+--------+

10. 部署redis失败,出现以下错误:

解决方法:这是由与Ansible的2.5.1.0版本不兼容的代码引起的。在我们修复代码以使其与最新版本的Ansible兼容之前,请坚持使用ansible-2.4.2.0暂时避免此问题。

The conditional check 'roles[instance_name].webui is defined or roles[instance_name].analytics is defined' failed. } 2018-04-21 15:27:24,288 p=23225 u=root | Read vars_file '{{ hostvars['localhost'].config_file }}' 2018-04-21 15:27:24,289 p=23225 u=root | TASK [install_contrail : create /etc/contrail/redis] ******************************************************************************************************************************************************************* 2018-04-21 15:27:24,289 p=23225 u=root | task path: /var/contrail-ansible-deployer/playbooks/roles/install_contrail/tasks/create_redis.yml:2 2018-04-21 15:27:24,379 p=23225 u=root | Read vars_file '{{ hostvars['localhost'].config_file }}' 2018-04-21 15:27:24,391 p=23225 u=root | fatal: [10.87.129.234]: FAILED! => { "msg": "The conditional check 'roles[instance_name].webui is defined or roles[instance_name].analytics is defined' failed. The error was: error while evaluating conditional (roles[instance_name].webui is defined or roles[instance_name].analytics is defined): 'dict object' has no attribute u'bms2'\n\nThe error appears to have been in '/var/contrail-ansible-deployer/playbooks/roles/install_contrail/tasks/create_redis.yml': line 2, 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: create /etc/contrail/redis\n ^ here\n" } 2018-04-21 15:27:24,491 p=23225 u=root | Read vars_file '{{ hostvars['localhost'].config_file }}' 2018-04-21 15:27:24,498 p=23225 u=root | fatal: [10.87.140.154]: FAILED! => { "msg": "The conditional check 'roles[instance_name].webui is defined or roles[instance_name].analytics is defined' failed. The error was: error while evaluating conditional (roles[instance_name].webui is defined or roles[instance_name].analytics is defined): 'dict object' has no attribute u'bms3'\n\nThe error appears to have been in '/var/contrail-ansible-deployer/playbooks/roles/install_contrail/tasks/create_redis.yml': line 2, 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: create /etc/contrail/redis\n ^ here\n" }

11.观察Cassandra的状态,例如“DB的磁盘太低”。

将磁盘增加到256Gb以上设置另一个阈值 contrail_configuration: CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: "2" DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: "2"

对于5.0.0版本,您需要指定CONFIG_NODEMGR__DEFAULTS__minimum_diskGB而不是CONFIG_DTABASE_NODEMGR__DEFAULTS__minimum_diskGB。

12. 控制器虚拟机的大小有16Gb或更小(演示版本)。安装不稳定。所有内存都被几个Java应用程序占用,或者来自daemon的错误响应:grpc: the connection is unavailable

原因:Java内存可以被配置中的下一条语句所限制。

解决方法:将以下配置添加到instance.yaml文件。

contrail_configuration: JVM_EXTRA_OPTS: "-Xms1g -Xmx2g"

另外,该语句只能应用于configdb角色,或者可以将不同的内存选项应用于实例定义中的configdb和analyticsdb角色。

13. libvirt容器无法启动:

------------------------------------------------------------------------------ + ./tools/deployment/common/wait-for-pods.sh openstack containers failed to start. NAME READY STATUS RESTARTS AGE IP NODE ... libvirt-8dhtx 0/1 CrashLoopBackOff 13 43m 172.17.0.1 ubuntu-2 nova-compute-default-z8qvb 0/1 CrashLoopBackOff 4 15m 172.17.0.1 ubuntu-2 ... ------------------------------------------------------------------------------

原因:Libvirt默认在许多操作系统上启动。一次只能运行一个libvirt副本。

解决方法:请检查主机上是否存在libvirtd。如果libvirtd在将成为部署目标的任何计算机上运行,则将其删除/禁用。libvirtd多个实例是不被支持的。

如何禁用它:

服务libvirt-bin停止update-rc.d libvirt-bin禁用

在Ubuntu上,apparmor有时会阻止libvirtd正常工作,错误为/usr/sbin/libvirtd: error while loading shared libraries: libvirt-admin.so.0: cannot open shared object file: Permission denied。要修复这个错误,请执行以下命令。

sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd

或者只是使用主机的软件包管理器将其删除。

更多详细信息,请关注TF中文社区。

14. 找不到“requests”包而导致的错误:

参考:Bug提交的解决方法(在部署者节点上):

更多详细信息,请关注TF中文社区。

yum -y install python-pip pip install requests

直到已经作为容器化解决方案/预安装的一部分得到解决。

最新回复(0)