部署环境
角色 | 机器名 | IP | 系统 |
计算节点 |
OpenStackControl | ens3 172.28.191.99 ens4 192.168.1.156 |
CentOS8.3 |
控制节点 | OpenStackCompute | ens3 172.28.191.88 ens4 192.168.1.177 |
CentOS8.3 |
部署节点 | localhosts(不重要) | ens3 172.28.191.55 |
CentOS8.3 |
注:计算节点和控制节点中不要包含 ‘_’
之后的就是官网的kolla-ansible的安装
yum install epel-release
yum install python-pip
pip install -U pip
yum install python-devel libffi-devel gcc openssl-devel libselinux-python
yum install ansible
pip install kolla-ansible
(官网上是这样的)
cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/
cp /usr/share/kolla-ansible/ansible/inventory/* .
(我的是这样的)
cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/
cp /usr/local/share/kolla-ansible/ansible/inventory/* .
git clone https://github.com/openstack/kolla
git clone https://github.com/openstack/kolla-ansible
pip install -r kolla/requirements.txt
pip install -r kolla-ansible/requirements.txt
cp kolla-ansible/ansible/inventory/* .
使用pip安装的时候可能会出现些依赖,通过报错进行修正就行了
官方网址:OpenStack Docs: Quick Start
因为是多节点的OpenStack,所以使用文件multinode
。
[control]
172.28.191.99 ansible_user=root ansible_password=foobar ansible_become=true
# Ansible supports syntax like [10:12] - that means 10, 11 and 12.
# Become clause means "use sudo".
[network:children]
control
# when you specify group_name:children, it will use contents of group specified.
[compute]
172.28.191.88 ansible_user=root ansible_password=foobar ansible_become=true
[monitoring]
compute
# This group is for monitoring node.
# Fill it with one of the controllers' IP address or some others.
[storage:children]
compute
[deployment]
localhost ansible_connection=local become=true
# use localhost and sudo
首先确认各个节点是通畅的
ansible -i multinode all -m ping
手动为kolla创建密码
kolla-genpwd
其次就是修改globals.yml文档了
kolla_base_distro: "centos"
kolla_install_type: "binary"
openstack_release: "victoria"
kolla_internal_vip_address: "172.28.191.99"
network_interface: "ens3"
neutron_external_interface: "ens4"
enable_haproxy: "no"
enable_keepalived: "{{ enable_haproxy | bool }}"
enable_cinder: "yes"
enable_cinder_backend_lvm: "yes"
cinder_volume_group: "cinder-volumes"
这里需要注意一点,组件cinder是管理集群的存储的,所以必须enable,但是在使用enable_cinder的时候,必须确保机器上存在一个cinder-volumes(默认,可在globals.yml修改)的卷组。
创建卷组的方式
pvcreate /dev/sdb /dev/sdc
vgcreate cinder-volumes /dev/sdb /dev/sdc
注意:磁盘修改卷组很危险,切记识别好准备好的磁盘
开始部署OpenStack
kolla-ansible -i ./multinode bootstrap-servers
在部署的时候可能会遇到相关的组件冲突,可以百度相关冲突进行解决
我这边是在
TASK [baremetal : Install RPM packages]
进行报错,因为podman buildah和docker冲突了,所以执行yum erase podman buildah -y解决这个问题,其他冲突可以类比这个
kolla-ansible -i ./multinode prechecks
部署的事前检查,其中我这边问题是
TASK [prechecks : Fail if a host NTP daemon is not running],
由于控制节点和计算节点时间不同步的原因,解决方案是
yum install chrony
ntp server:
vim /etc/chrony.conf
allow 192.168.0.0/24
server ntp1.aliyun.com iburst
[root@localhost ~]# chronyc sources
210 Number of sources = 4
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? sv1.ggsrv.de 2 6 1 0 -88239s[-88239s] +/- 76ms
^? 119.28.183.184 2 6 1 1 -88239s[-88239s] +/- 50ms
之后再计算节点的时候出现
TASK [nova-cell : Checking that libvirt is not running]
解决方法是
rm /var/run/libvirt/libvirt-sock -f
进行部署
kolla-ansible -i ./multinode deploy
期间可能会出现很多问题,耐心解决吧,有一个问题我需要提一下
在deploy完毕之后检查容器的运行状态,发现了kolla/centos-binary-horizon这个容器一直重启,导致了无法从web访问OpenStack,通过查验容器日志,以及kolla-ansible的源代码,发现在容器中有三个环境变量没有设定,解决方案如下
修改文件/usr/local/share/kolla-ansible/ansible/roles/horizon/defaults/main.yml
在
project_name: "horizon"
horizon_services:
horizon:
container_name: horizon
group: horizon
enabled: true
image: "{{ horizon_image_full }}"
environment:
ENABLE_BLAZAR: "{{ 'yes' if enable_horizon_blazar | bool else 'no' }}"
.....
中追加三个参数定义
project_name: "horizon"
horizon_services:
horizon:
container_name: horizon
group: horizon
enabled: true
image: "{{ horizon_image_full }}"
environment:
ENABLE_BLAZAR: "{{ 'yes' if enable_horizon_blazar | bool else 'no' }}"
ENABLE_KARBOR: "no"
ENABLE_QINLING: "no"
ENABLE_SEARCHLIGHT: "no"
.....
容器就能够正常启动了
之后就是部署完毕之后的post-deploy
可以在部署节点做也可以都做
pip install python-openstackclient python-glanceclient python-neutronclient
kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
初始化集群
会创建镜像,网络等
. /usr/share/kolla-ansible/init-runonce
可以通过web界面查看了
对于后续的使用问题,可以给我留言,我也是小白,可能我也不清楚,但是很乐意一起探讨。