在部署 Kolla-Ansible 时,虽然能够同时部署 Ceph Cluster,但是在一些情况下,维运人员会希望将 Ceph 跟 OpenStack 分开管理,可是又想要利用 Ceph 当储存的 Backend。这时可不用担心,Kolla-Ansible 可以运用之前提过的 config override 的功能来使用 External Ceph Cluster。本篇文章将会介绍如何使用 Kolla-Ansible 和其 config override 的功能部署 OpenStack 并使用外部的 Ceph。
既然要使用外部的 Ceph Cluster,首相需要部署出一个 Ceph 集群。部署 Ceph 的方法有很多选择,也可以参考之前介绍过的 Ceph-Ansible 进行部署。
另外我们也需要一些使用 Kolla-Ansible 的基础跟相关知识,可以参考这篇文章:透过 Kolla-Ansible 跟 Container 部署 OpenStack
OpenStack Nova, Cinder (Cinder Backup), Glance 都可以使用 RBD 作为储存 Backend,所以需要为这三个 service 创建其使用的 RBD Pool。
sudo ceph osd pool create images 128
sudo ceph osd pool create vms 128
sudo ceph osd pool create volumes 128
Ceph 是透过 Keyring 做认证的,所以同样会需要为三个 service 创建相对应的 Keyring,并且给予其所使用的 Pool 权限。
sudo ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rdb_children, allow rwx pool=images' -o /etc/ceph/ceph.client.glance.keyring
sudo ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rx pool=images' -o /etc/ceph/ceph.client.cinder.keyring
sudo ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups -o /etc/ceph/ceph.client.cinder-backup.keyring
sudo ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=vms, allow rx pool=images' -o /etc/ceph/ceph.client.nova.keyring
globals.yml
在 globals.yml
中我们必须将透过部署 Kolla-Ansible Ceph 的选项设为 no,不过将 Nova, Cinder, Glance 使用 Ceph 作为储存 backend 的选项设为 yes。
enable_ceph: "no"
glance_backend_ceph: "yes"
cinder_backend_ceph: "yes"
nova_backend_ceph: "yes"
设定 Glance 使用 external Ceph 基本上包含三个步骤:
glance-api.conf
设定使用 rbd backend/etc/ceph/ceph.conf
新增 Ceph 的设定/etc/ceph/ceph.client.images.keyring
第一步是需要透过 config override 实现的,首先在建立 /etc/kolla/config/glance/glance-api.conf
并新增以下内容
[glance_store]
stores = rbd
default_store = rbd
rbd_store_pool = images
rbd_store_user = glance
rbd_store_ceph_conf = /etc/ceph/ceph.conf
接下来在第二步同样在 /etc/kolla/config/glance/ceph.conf
加入 Ceph 的设定
[global]
fsid = 88a8ea91-df1d-4f67-b78b-52bb2f04df4d
mon_initial_members = ceph01, ceph02, ceph03
mon_host = 192.168.113.10,192.168.113.11,192.168.113.10
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
最後将上面已经创建好的 keyring 放到 /etc/kolla/config/glance/ceph.client.glance.keyring
sudo cp /etc/ceph/ceph.client.glance.keyring /etc/kolla/config/glance/ceph.client.glance.keyring
Kolla-Ansible 会将资料夹下所有 ceph*
的档案放到 container 内的 /etc/ceph 下。
Cinder 设定的步骤跟 Glance 雷同,先建立 /etc/kolla/config/cinder/cinder-volume.conf
并新增以下内容
[DEFAULT]
enabled_backends=rbd-1
[rbd-1]
rbd_ceph_conf=/etc/ceph/ceph.conf
rbd_user=cinder
backend_host=rbd:volumes
rbd_pool=volumes
volume_backend_name=rbd-1
volume_driver=cinder.volume.drivers.rbd.RBDDriver
rbd_secret_uuid = {{ cinder_rbd_secret_uuid }}
接下来设定 Cinder-Backup,创建 /etc/kolla/config/cinder/cinder-backup.conf
并加入以下内容
[DEFAULT]
backup_ceph_conf=/etc/ceph/ceph.conf
backup_ceph_user=cinder-backup
backup_ceph_chunk_size = 134217728
backup_ceph_pool=backups
backup_driver = cinder.backup.drivers.ceph
backup_ceph_stripe_unit = 0
backup_ceph_stripe_count = 0
restore_discard_excess_bytes = true
接下来一样将 ceph.conf
放到 /etc/kolla/config/cinder/`` 下
最後需要 copy 所有的 keyring。
sudo cp /etc/ceph/ceph.client.cinder.keyring /etc/kolla/config/cinder/cinder-backup/ceph.client.cinder.keyring
sudo cp /etc/ceph/ceph.client.cinder.keyring /etc/kolla/config/cinder/cinder-volume/ceph.client.cinder.keyring
sudo cp /etc/ceph/ceph.client.cinder-backup.keyring /etc/kolla/config/cinder/cinder-backup/ceph.client.cinder-backup.keyring
Nova 设定也很相似,基本上会是一样的步骤
根据下面内容建立 /etc/kolla/config/nova/nova-compute.conf
[libvirt]
images_rbd_pool=vms
images_type=rbd
images_rbd_ceph_conf=/etc/ceph/ceph.conf
rbd_user=nova
将 ceph.conf
放到 /etc/kolla/config/nova/`` 下
最後 copy keyring
sudo cp /etc/ceph/ceph.client.nova.keyring /etc/kolla/config/nova/ceph.client.nova.keyring
关於实际部署的指令想要了解更多可以看 透过 Kolla-Ansible 跟 Container 部署 OpenStack
cd kolla-ansible
tools/generate_passwords.py
tools/kolla-ansible -i ansible/inventory/multinode bootstrap-servers
tools/kolla-ansible -i ansible/inventory/multinode prechecks
tools/kolla-ansible -i ansible/inventory/multinode deploy
Playbook 顺利跑完的後,可以试着使用各个 service,确认能够正常运作。
正文: 利用 UserDefault 储存资料 预览图: 程序码: import UIKit cla...
这两天去上 SIY 的工作坊,为了应景,改变一下主题。手边刚好有明就仁波切的《世界上最快乐的人》,摘...
11.2 距离不超过 3 倍的 Baswana-Sen Spanner 如果我们把近似最短距离的要求...
昨天我们利用service把计算sign的逻辑串接起来,今天继续来试试看,要如何取得永丰Api的re...
-身份和存取管理 典型的身份验证过程包括三个步骤: 主体向身份提供者 (IdP) 表明其身份。 I...