温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

kolla-ansible如何安装openstack企业级高可用集群

发布时间:2021-12-04 10:20:49 来源:亿速云 阅读:371 作者:小新 栏目:云计算

这篇文章主要介绍了kolla-ansible如何安装openstack企业级高可用集群,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

一.环境准备

1.hosts设置

每台设备两块网卡:

第一块:NAT模式,用于下载软件包,设置好IP可以上网

第二块:桥接模式,用于External网络,用于虚拟机连接外部网络,不用设置IP

hosts:

hosteth0eth2
deploy9.110.187.130
controller019.110.187.131不需要IP
controller029.110.187.132不需要IP
compute019.110.187.133不需要IP
compute029.110.187.134不需要IP
storage9.110.187.135不需要IP
2.ssh免密登录
ssh-keygen
ssh-copy-id root@controller01
ssh-copy-id root@controller02
ssh-copy-id root@compute01
ssh-copy-id root@compute02
ssh-copy-id root@storage
3.存储节点配置
  1. 要启动cinder存储服务,需先添加一块新的硬盘,然后创建pv、vg

[root@storage ~]# pvcreate /dev/sdb
[root@storage ~]# vgcreate cinder-volumes /dev/sdb  //vg名取名为 cinder-volumes,这里主要跟 kolla配置文件里vg名一致
  1. 只允许vm实例访问块存储卷,对LVM可能出现异常做设置

vim /etc/lvm/lvm.conf

#修改 devices 下面的,有多少块硬盘就写多少块,如果不想使用系统盘,则不写a|sda
filter = [ "a|sda|", "a|sdb|", "r|.*|" ]

#重启lvm服务
systemctl restart lvm2-lvmetad.service
4.配置国内PIP源

所有节点都需要配置

mkdir ~/.pip

cat << EOF > ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
EOF
5.安装PIP
#安装依赖
yum install -y python-devel libffi-devel gcc openssl-devel libselinux-python

#安装PIP
yum install -y python-pip
pip install --upgrade pip
6.安装docker
  1. 所有节点都安装

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce
  1. 配置Docker共享挂载

mkdir /etc/systemd/system/docker.service.d 
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF' 
[Service] 
MountFlags=shared 
EOF
  1. 使用阿里加速地址

mkdir -p /etc/docker

systemctl daemon-reload && systemctl enable docker && systemctl restart docker
systemctl status docker

二.部署节点安装

1.安装docker模块
pip install docker   //这个其它节点也需要安装,否则后面会报错
2.ansible安装
yum install -y ansible
pip install -U ansible
3.安装kolla和kolla-ansible
  • Kolla-Ansible 可以从pip安装,也可以从git安装,这里演示从pip安装

pip install kolla kolla-ansible

错误解决方案

  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.

解决:强制更新

pip install --ignore-installed PyYAML
  1. 如果出现requests 2.20.0 has requirement idna<2.8,>=2.5, but you'll have idna 2.4 which is incompatible.错误,则强制更新requets

pip install --ignore-installed requests
  • 配置kolla-ansible

    1)拷贝globals.yml 和passwords.yml 到 /etc/kolla 目录

    cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/

    2)拷贝kolla-ansible的主机清单文件(all-in-one和multinode)

    cp /usr/share/kolla-ansible/ansible/inventory/* /home/

注:如果是在虚拟机里再启动虚拟机,那么需要把virt_type=qemu,默认是kvm

mkdir -p /etc/kolla/config/nova 
cat << EOF > /etc/kolla/config/nova/nova-compute.conf 
[libvirt] 
virt_type=qemu 
cpu_mode = none 
EOF
4.生成密码文件
kolla-genpwd

修改下面字段,使用方便的密码

vim /etc/kolla/passwords.yml

 keystone_admin_password: devops
5.修改配置文件
  1. grep -Ev "^$|^[#;]" /etc/kolla/globals.yml

kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "rocky"
kolla_internal_vip_address: "9.110.187.180"
network_interface: "eth0"
api_interface: "{{ network_interface }}"
neutron_external_interface: "eth2"
neutron_plugin_agent: "openvswitch"
enable_cinder: "yes"
enable_cinder_backend_iscsi: "yes"
enable_cinder_backend_lvm: "no"
enable_haproxy: "yes"
enable_heat: "yes"
glance_enable_rolling_upgrade: "no"
ironic_dnsmasq_dhcp_range:
tempest_image_id:
tempest_flavor_ref_id:
tempest_public_network_id:
tempest_floating_network_name:
  1. 编辑/home/multinode文件

[control]
controller01
controller02

[network]
controller01
controller02

[inner-compute]

[external-compute]
compute01
compute02

[compute:children]
inner-compute
external-compute

[monitoring]
deploy

[storage]
storage

[deployment]
localhost       ansible_connection=local
........
6.网关配置

这里physnet1是对外网络的名字,在dashboard里创建供应商网络的名字要和这里对应

vim /usr/share/kolla-ansible/ansible/roles/neutron/templates/ml2_conf.ini.j2

[ml2_type_vlan]
{% if enable_ironic | bool %}
network_vlan_ranges = physnet1
{% else %}
network_vlan_ranges = physnet1
{% endif %}

三.openstack集群安装

1.提前拉取镜像
kolla-ansible -i ./multinode pull -vvv
2.确认inventory配置文件是否正确
ansible -m ping all -i ./multinode
3.Bootstrap服务的依赖安装
kolla-ansible -i ./multinode bootstrap-servers
4.检查
kolla-ansible -i ./multinode prechecks
5.部署
kolla-ansible -i ./multinode deploy

注:可以加-vvv,显示更多
6.使用openstack
  • 生成环境变量和脚本

kolla-ansible -i ./multinode post-deploy
此时会在/etc/kolla下面生成admin-openrc.sh脚本,执行一下

至此multinodes部署完成,浏览器输入外网访问地址:http://9.110.187.180,即可访问Openstack的登陆页面,用户名和密码都是之前设置的

  • 各节点上服务常用目录

/etc/kolla    服务配置目录

/var/lib/docker/volumes/kolla_logs/_data  服务日志目录

/var/lib/docker/volumes   服务数据映射的目录

销毁openstack

kolla-ansible destroy -i ./multinode  --yes-i-really-really-mean-it

感谢你能够认真阅读完这篇文章,希望小编分享的“kolla-ansible如何安装openstack企业级高可用集群”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI