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

一.环境准备1.hosts设置 每台设备两块网卡: 第一块:NAT模式,用于下载软件包,设置好IP可以上网 第二块:桥接模式,用于External网络,用于虚拟机连接外部网络,不用设置IP   hosts:hosteth0eth1deploy9.110.187.130 controller019.110.187.131不需要IPcontroller029.110.187.132不需要IPcompute019.110.187.133不需要IPcompute029.110.187.134不需要IPstorage9.110.187.135不需要IP2.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

错误解决方案[list=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
    [list=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-ansible1)拷贝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.修改配置文件[list=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: "eth1"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:
    [list=1]
  • 编辑/home/multinode文件
  • [control]controller01controller02​[network]controller01controller02​[inner-compute]​[external-compute]compute01compute02​[compute:children]inner-computeexternal-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
     

    0 个评论

    要回复文章请先登录注册