Ceph keyring 文件示例

OpenStack-Ansible (OSA) 允许部署一个使用现有 Ceph 集群作为块存储的 OpenStack 环境,用于镜像、卷和实例。与 Ceph 集群的交互通常通过 SSH 到 Ceph MONs 进行。为了避免访问 Ceph 集群节点的 SSH 访问,所有必要的客户端配置都可以从文件中读取。本示例描述了这些文件需要包含的内容。

此示例只有一个主要要求。您需要在 OpenStack 环境中配置一个存储网络。Ceph 服务 - MONs 和 OSDs - 都需要连接到此存储网络。在 OpenStack 侧,您需要将受影响的服务连接到存储网络。Glance 用于在 Ceph 中存储镜像,Cinder 用于在 Ceph 中创建卷,并且在大多数情况下,计算节点用于使用卷,并可能在 Ceph 中存储临时磁盘。

网络配置假设

此环境使用以下 CIDR 分配。

网络

CIDR

存储网络

172.29.244.0/22

IP 分配

此环境使用以下主机名和 IP 地址分配。

主机名

存储 IP

ceph1

172.29.244.18

ceph2

172.29.244.19

ceph3

172.29.244.20

配置

环境定制

对于 Ceph 环境,您可以运行 cinder-volume 在容器中。默认情况下 cinder-volume 在主机上运行。请参阅 此处,了解如何在容器中运行服务的示例。

用户变量

/etc/openstack_deploy/user_variables.yml 文件定义了默认变量的全局覆盖。

对于此示例环境,我们配置一个现有的 Ceph 集群,我们希望 OpenStack 环境连接到它。您的 /etc/openstack_deploy/user_variables.yml 必须具有以下内容才能配置 Ceph 用于镜像、卷和实例。如果并非所有必要的块存储都应从 Ceph 后端提供,则仅包含您想要存储在 Ceph 中的块存储

---
# OSA options for using an existing Ceph deployment. This example can be used
# if all configuration needs to come from OSA configuration files instead of
# the Ceph MONs.

# Directory containing the Ceph keyring files with access credentials.
ceph_keyrings_dir: /etc/openstack_deploy/ceph-keyrings

# General Ceph configuration file containing the information for Ceph clients
# to connect to the Ceph cluster.
ceph_conf_file: |
   [global]
   mon initial members = ceph1,ceph2,ceph3
   ## Ceph clusters starting with the Nautilus release can support the v2 wire protocol
   mon host = [v2:172.29.244.18:3300,v1:172.29.244.18:6789],[v2:172.29.244.19:3300,v1:172.29.244.19:6789],[v2:172.29.244.20:3300,v1:172.29.244.20:6789]
   ## for a Ceph cluster not supporting the v2 wire protocol (before Nautilus release)
   # mon host = [v1:172.29.244.18:6789],[v1:172.29.244.19:6789],[v1:172.29.244.20:6789]

# For configuring the Ceph backend for Glance to store images in Ceph.
glance_ceph_client: glance
glance_default_store: rbd
glance_rbd_store_pool: images

# For configuring a backend in Cinder to store volumes in Ceph. This
# configuration will be used for Nova compute and libvirt to access volumes.
cinder_ceph_client: cinder

cinder_backends:
  rbd:
    volume_driver: cinder.volume.drivers.rbd.RBDDriver
    rbd_pool: volumes
    rbd_ceph_conf: /etc/ceph/ceph.conf
    rbd_store_chunk_size: 8
    volume_backend_name: rbd
    rbd_user: "{{ cinder_ceph_client }}"
    rbd_secret_uuid: "{{ cinder_ceph_client_uuid }}"
    report_discard_supported: true

# Configuration for Nova compute and libvirt to store ephemeral discs in Ceph.
nova_libvirt_images_rbd_pool: vms

Ceph 密钥环

使用 /etc/openstack_deploy/user_variables.yml 中的上述设置,我们配置为在 /etc/openstack_deploy/ceph-keyrings/ 目录中读取访问 Ceph 集群的凭据。现在我们需要将 Ceph 凭据的密钥环文件放置到此目录中。它们需要根据 Ceph 客户端名称命名,例如 glance.keyring 根据 glance_ceph_client: glance。有关文件内容的示例,请参见以下内容

[client.glance]
	key = AQC93h9fAAAAABAAUrAlQF+xJnjD6E8ChZkTaQ==