An install on several machines keeps its shared data on Ceph, which Rook runs on the machines themselves. Each machine keeps all of its storage in one ZFS pool: Ceph's disk, the volumes that stay on that machine, and what the system writes. Make the pool by hand on each machine, before the platform starts Ceph there.
Each machine has the same layout:
| Part | Where | Holds |
|---|---|---|
| The system | its own partitions on the fast disk | the Gingko OS, read-only |
| Data vdevs | the slow, large disks, striped | Ceph's data, and large local volumes |
| Special vdev | most of the fast disk | every dataset's metadata, and the datasets that ask for it |
| Log vdev | a few GB of the fast disk | the pool's synchronous writes |
The pool has no mirror and no RAID-Z. Ceph keeps three copies of the shared data on three machines, and a database keeps its replica on another machine. When a disk fails, that machine's pool is lost, and the other machines still have every copy.
So a local volume holds only what survives the loss of its machine's pool:
Keep everything else on Ceph.
The pool is encrypted. Its key is a file the machine reads at boot, so it starts without help.
Where the file goes depends on whether the machine has a TPM 2.0:
install.encrypted_partitions: [COS_PERSISTENT].
The OS then encrypts its persistent partition with a key that only this
machine's TPM releases. Put the pool's key there, under /usr/local. A disk
that leaves the machine carries nothing that can open the pool./oem. The slow disks
then carry no key. The fast disk carries both the key and the special vdev,
so before a working fast disk leaves the machine, for example in a disk swap,
erase it with blkdiscard.Use a machine with a TPM 2.0 when you can choose. Without a TPM:
dd if=/dev/urandom of=/oem/gingko-pool.key bs=32 count=1
chmod 400 /oem/gingko-pool.key
Copy the key to your password manager. Without it, nobody can read the pool.
Name each disk by a path that does not change, from /dev/disk/by-id. In this
example the pool is gko, the two slow disks are hdd-a and hdd-b, and the
fast disk's partitions for the special and log vdevs are nvme-part5 and
nvme-part6:
zpool create -o ashift=12 \
-O mountpoint=none -O compression=lz4 \
-O encryption=aes-256-gcm -O keyformat=raw \
-O keylocation=file:///oem/gingko-pool.key \
gko /dev/disk/by-id/hdd-a /dev/disk/by-id/hdd-b \
special /dev/disk/by-id/nvme-part5 \
log /dev/disk/by-id/nvme-part6
With a TPM, keylocation names the key's path under /usr/local instead.
Every dataset and volume in the pool inherits the encryption.
A dataset goes on the fast disk when its special_small_blocks is equal to or
larger than its block size. The system's datasets go there:
for d in rancher:/var/lib/rancher kubelet:/var/lib/kubelet cni:/var/lib/cni log:/var/log; do
zfs create -u -o special_small_blocks=128K -o mountpoint=${d#*:} gko/${d%%:*}
done
The platform's dataset is <pool>/<domain>. Make it, and the three parents
under it that the storage classes use:
zfs create gko/example.org
zfs create -o special_small_blocks=128K gko/example.org/fast
zfs create -o primarycache=metadata -o secondarycache=none \
-o logbias=throughput gko/example.org/osd-data
zfs create -o special_small_blocks=16K gko/example.org/osd-db
| Dataset | Used by |
|---|---|
fast |
the local-fast class: volumes on the fast disk, for databases |
osd-data |
Ceph's data, a volume that grows as Ceph writes |
osd-db |
Ceph's metadata, on the fast disk |
In the cloud-config, name the pool so that the OS loads its key and imports it at each boot, and limit how much memory ZFS keeps for its cache. ZFS takes most of the memory when nothing limits it.
stages:
initramfs:
- files:
- path: /etc/conf.d/gingko-pool
content: pool=gko
- path: /etc/modprobe.d/zfs.conf
content: options zfs zfs_arc_max=4294967296
Label each machine that has its pool, so that Ceph puts a disk there:
kubectl label node <machine> gingko.garden/zfs-pool=true
Then set the platform's values: the dataset, and one Ceph disk for each labelled machine.
platform:
zfs:
dataset: gko/example.org
rook:
enabled: true
zfsOsds:
count: 3
The Checks tab shows a pool that is more than 80% full. Ceph's data and the local volumes share the pool, so it can fill before Ceph reports that it is full.
Last validated: · View as Markdown