Creating and mounting Ceph volume into VM

So I have microcloud installed (yay) and have started creating vms, and the vms are all using the ceph (remote) storage for replication/moving between cloud nodes.

Let’s say that one of the VMs is going to host Microk8s, and one pod is going to host a Postgres database, and I want the persisted store of Postgres not in the VM itself, but from the Ceph remote layer at the cloud level.

I’m assuming that I just use the rbd command to create the Ceph storage, then attach the new block device to the VM hosting microk8s and mount it, then configure the pod so it uses the special store for the Postgres database.

Sound about right?

The way this is done in MicroCloud/LXD is to create a custom volume on the storage pool and then attach that to the instance as a disk device.

E.g.

lxc storage volume create <pool_name> <volume_name> size=1GiB
lxc config device add <instance> foo disk pool=<pool_name> source=<volume_name>

This would create an RBD volume (if using a ceph pool), format it with ext4 (this is configurable on the volume at create time) and pass it through as a filesystem disk to the instance.

If you truly want just a block volume passed to the instance you can specify this using:

lxc storage volume create <pool_name> <volume_name> size=1GiB --type=block

See https://documentation.ubuntu.com/lxd/en/latest/howto/storage_volumes/
And https://documentation.ubuntu.com/lxd/en/latest/reference/storage_ceph/#storage-volume-configuration

1 Like

Thanks! I think it’s time to dive into all of the various lxc commands and subcommands to understand how they all are connected…

1 Like