2.4. 配置 Ceph 客户端身份验证
您可以为 Ceph 客户端配置身份验证来访问 Red Hat OpenStack Platform。
先决条件
- 对 Ceph 监控主机的 root 级别访问权限。
- 一个正在运行的 Red Hat Ceph Storage 集群。
流程
在 Ceph 监控主机上,为 Cinder、Cinder 备份和 Glance 创建新用户:
[root@mon ~]# ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' [root@mon ~]# ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups' [root@mon ~]# ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'
将
client.cinder、client.cinder-backup和client.glance的密钥环添加到适当的节点,并更改其所有权:[root@mon ~]# ceph auth get-or-create client.cinder | ssh CINDER_VOLUME_NODE sudo tee /etc/ceph/ceph.client.cinder.keyring [root@mon ~]# ssh CINDER_VOLUME_NODE chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring [root@mon ~]# ceph auth get-or-create client.cinder-backup | ssh CINDER_BACKUP_NODE tee /etc/ceph/ceph.client.cinder-backup.keyring [root@mon ~]# ssh CINDER_BACKUP_NODE chown cinder:cinder /etc/ceph/ceph.client.cinder-backup.keyring [root@mon ~]# ceph auth get-or-create client.glance | ssh GLANCE_API_NODE sudo tee /etc/ceph/ceph.client.glance.keyring [root@mon ~]# ssh GLANCE_API_NODE chown glance:glance /etc/ceph/ceph.client.glance.keyring
OpenStack Nova 节点需要
nova-compute进程的密钥环文件:[root@mon ~]# ceph auth get-or-create client.cinder | ssh NOVA_NODE tee /etc/ceph/ceph.client.cinder.keyringOpenStack Nova 节点还需要将
client.cinder用户的机密密钥存储在libvirt中。在从 Cinder 附加块设备时,libvirt进程需要 secret 密钥来访问集群。在 OpenStack Nova 节点上创建 secret 密钥的临时副本:[root@mon ~]# ceph auth get-key client.cinder | ssh NOVA_NODE tee client.cinder.key如果存储集群包含使用
exclusive-lock功能的 Ceph 块设备镜像,请确保所有 Ceph 块设备用户都有 blocklist 客户端的权限:[root@mon ~]# ceph auth caps client.ID mon 'allow r, allow command "osd blacklist"' osd 'EXISTING_OSD_USER_CAPS'
返回到 OpenStack Nova 主机:
[root@mon ~]# ssh NOVA_NODE为 secret 生成 UUID,并保存 secret 的 UUID,以便稍后配置
nova-compute:[root@nova ~]# uuidgen > uuid-secret.txt
注意您不一定需要所有 Nova 计算节点上的 UUID。但是,从平台一致性的角度来看,最好保持相同的 UUID。
在 OpenStack Nova 节点上,将 secret 密钥添加到
libvirt中,并删除密钥的临时副本:cat > secret.xml <<EOF <secret ephemeral='no' private='no'> <uuid>`cat uuid-secret.txt`</uuid> <usage type='ceph'> <name>client.cinder secret</name> </usage> </secret> EOF为
libvirt设置并定义 secret:[root@nova ~]# virsh secret-define --file secret.xml [root@nova ~]# virsh secret-set-value --secret $(cat uuid-secret.txt) --base64 $(cat client.cinder.key) && rm client.cinder.key secret.xml
其它资源
- 如需了解更多详细信息,请参阅 Red Hat Ceph Storage Administration Guide 中的 Managing Ceph users 章节。
- 以了解更多有关用户功能的信息,请参阅 Integrating an Overcloud with an Existing Red Hat Ceph Cluster Guide 中的 配置现有 ceph 存储集群 一节。