Skip to content

CephFS shares

A CephFS share gives your Pods a ReadWriteMany or ReadOnlyMany volume that any number of Pods on any node can mount at once. The share stays in your Arbutus project: you create, resize and delete it in OpenStack, it counts against your project’s Manila quota, and your VMs can mount it at the same time as your Pods. Kestrel never creates, resizes or deletes a share.

You never create a PersistentVolume. You create a Secret holding the share’s access key and a PersistentVolumeClaim annotated with the share’s path, and Kestrel creates a PersistentVolume for that claim and binds it.

Skip this step to use a share you already have.

  1. Log in to the Arbutus dashboard and select your project.
  2. Go to Project → Share → Shares and click Create Share.
  3. Fill in:
    • Share Name: a name for the share
    • Share Protocol: CephFS
    • Size (GiB): the capacity you need
    • Share Type: cephfs
  4. Click Create, and wait until the share’s Status is Available.

The share’s size is its real limit: writes fail once it is full. Grow it in OpenStack (Extend Share in Horizon, openstack share resize <share> <new-size> on the CLI); nothing on Kestrel changes.

2. Create an access rule and read the key and path

Section titled “2. Create an access rule and read the key and path”

An access rule creates a cephx key that can mount this share and nothing else. Name the rule for what will use it, such as kestrel-<tenant>. That name becomes the key’s user ID.

  1. In Project → Share → Shares, open the drop-down menu on the share’s row and choose Manage Rules.
  2. Click Add Rule and fill in:
    • Access Type: cephx
    • Access Level: read-write, or read-only for a share your Pods only read
    • Access To: the rule name, for example kestrel-<tenant>
  3. Click Add, and wait until the rule’s status is active. The rule’s Access Key column then shows the key.
  4. Click the share’s name to open its overview. Under Export locations, the Path looks like <monitor>:6789,<monitor>:6789,<monitor>:6789:/volumes/_nogroup/<uuid>/<uuid>.

Note down three values:

ValueWhere it comes fromExample
Access namethe rule’s Access Tokestrel-<tenant>
Access keythe rule’s Access KeyAQ...==
Share paththe export location Path, from /volumes onwards, with no monitors/volumes/_nogroup/<uuid>/<uuid>

3. Give your Pods ownership of the share (read-write only)

Section titled “3. Give your Pods ownership of the share (read-write only)”

A new share’s top directory is owned by root with mode 755. Kestrel Pods must run as a non-root user, and Kestrel does not change a share’s ownership for them: setting fsGroup in a Pod has no effect on a CephFS share. Unless you change the ownership once, your Pods can read the share but every write fails with Permission denied.

Choose the user and group ID your Pods will run as, 1000:1000 in these examples. On a VM in your Arbutus project, install the Ceph client:

Terminal window
sudo apt-get update
sudo apt-get install -y ceph-common # Ubuntu / Debian; use your distribution's ceph-common package elsewhere

Create /etc/ceph/ceph.conf, unless the VM already has one. This is the Arbutus configuration from the Alliance CephFS page. If your share’s Path from step 2 lists different monitors, use those.

Terminal window
sudo tee /etc/ceph/ceph.conf > /dev/null <<'EOF'
[global]
admin socket = /var/run/ceph/$cluster-$name-$pid.asok
client reconnect stale = true
debug client = 0/2
fuse big writes = true
mon host = [v2:134.87.15.61:3300/0,v1:134.87.15.61:6789/0] [v2:134.87.15.62:3300/0,v1:134.87.15.62:6789/0] [v2:134.87.15.63:3300/0,v1:134.87.15.63:6789/0]
[client]
quota = true
EOF

Create a keyring file for the access rule. Paste the key at the prompt, which keeps it out of your shell history and off the screen:

Terminal window
sudo install -m 600 /dev/null /etc/ceph/ceph.client.<access-name>.keyring
read -rsp 'Access key: ' KEY; echo; printf '[client.<access-name>]\n key = %s\n' "$KEY" | sudo tee /etc/ceph/ceph.client.<access-name>.keyring > /dev/null; unset KEY

Mount the share, change the owner, then remove the keyring:

Terminal window
sudo mkdir -p /mnt/share
sudo mount -t ceph :/volumes/_nogroup/<uuid>/<uuid> /mnt/share -o name=<access-name>
sudo chown 1000:1000 /mnt/share
sudo umount /mnt/share
sudo rm /etc/ceph/ceph.client.<access-name>.keyring

The path is the Share path from step 2. The leading : is required: it makes the mount read the monitors from ceph.conf. Use a read-write access rule for this mount.

You only need to do this once per share. Skip it when the share is read-only for your Pods, or when it already holds data owned by the user your Pods run as. To give several users access, change the group instead (for example sudo chgrp 2000 /mnt/share && sudo chmod 2775 /mnt/share) and run your Pods with that group.

Create the Secret in the namespace whose Pods will mount the share, before you create the claim. userID is the access name, without a client. prefix, and userKey is the access key.

Seal the Secret and commit the SealedSecret alongside the claim. See Sealed Secrets on Kestrel for installing kubeseal.

Terminal window
kubectl create secret generic <share>-cephx \
--namespace <tenant>-prod \
--from-literal=userID=<access-name> \
--from-literal=userKey=<access-key> \
--dry-run=client -o yaml \
| kubeseal --format yaml --controller-namespace sealed-secrets > <share>-cephx-sealedsecret.yaml

Give the SealedSecret the argocd.argoproj.io/sync-wave: "-1" annotation, so ArgoCD applies it before the claim.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-data
namespace: <tenant>-prod
annotations:
rcs.uvic.ca/share-path: /volumes/_nogroup/<uuid>/<uuid>
rcs.uvic.ca/share-secret: <share>-cephx
spec:
storageClassName: ''
volumeName: <tenant>-prod-shared-data
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
  • volumeName must be exactly <namespace>-<claim name>.
  • accessModes holds one mode: ReadWriteMany, or ReadOnlyMany to mount the share read-only.
  • storage should be a nominal 1Gi. It limits nothing, because the share’s size in OpenStack does, but it still counts against your tenant’s storage quota. See Quotas.

Within a few seconds the claim is Bound to a volume of the same name:

Terminal window
kubectl get pvc shared-data -n <tenant>-prod
# NAME STATUS VOLUME CAPACITY ACCESS MODES
# shared-data Bound <tenant>-prod-shared-data 1Gi RWX

The PersistentVolume is cluster-scoped and created by Kestrel, so you see only the claim.

Mount the claim as you would any other, and run as the user and group from step 3:

spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: app
image: your-image:latest
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
volumeMounts:
- name: shared
mountPath: /data
volumes:
- name: shared
persistentVolumeClaim:
claimName: shared-data

Every Pod that mounts the claim, on any node, sees the same files, and so does any VM that mounts the share.

To mount a sub-folder with subPath, create the sub-folder first. The kubelet creates a missing subPath owned by root, and step 3’s chown covers only the share’s top directory, so a non-root Pod cannot write to it. Create it from a VM with the share mounted as in step 3 (sudo install -d -o 1000 -g 1000 /mnt/share/<folder>), or from a Pod running as the share’s owner (mkdir /data/<folder>).

  • The annotations cannot be changed. To point the claim at another share or Secret, delete the claim and create it again.
  • Deleting the claim, or its namespace, deletes the PersistentVolume. The share and its data are untouched. Delete the share in OpenStack when you no longer need it.
  • To rotate the key, add a new access rule, put its name and key in the same Secret (re-seal it if you use a SealedSecret), restart the Pods that mount the share, then delete the old rule.
Message starts withFix
A share PVC needs both the rcs.uvic.ca/share-path and the rcs.uvic.ca/share-secret annotation.Add the missing annotation.
rcs.uvic.ca/share-path must be the share's path from its Manila export locationUse the path from /volumes onwards, with no monitors and no trailing slash.
A share PVC must set spec.volumeName toSet volumeName to the value in the message, <namespace>-<claim name>.
A share PVC must set storageClassName to ""Set storageClassName: ''.
A share PVC must have exactly one access modeUse ReadWriteMany or ReadOnlyMany, not both.
rcs.uvic.ca/share-secret must be the name of a Secret in this namespace.The annotation holds the Secret’s name only, in lower case.
The Secret named in rcs.uvic.ca/share-secret must exist inCreate the Secret, with both userID and userKey, in the same namespace first. A SealedSecret must have unsealed.
spec.volumeName may name only a PersistentVolume reserved for this PVCAnother claim already uses that volume name. Choose a different claim name.
A PVC without a StorageClass must set spec.volumeNameA claim with storageClassName: '' must name its volume.
The rcs.uvic.ca/share-path and rcs.uvic.ca/share-secret annotations cannot beDelete the claim and create it again.
exceeded quotaThe storage request counts against your tenant’s quota. Request 1Gi.

kubectl describe pod shows a FailedMount event ending in mount error 13 = Permission denied. The key cannot mount that path. Check that:

  • the access rule is active;
  • userID is the access name with no client. prefix, and userKey is that rule’s key;
  • the rcs.uvic.ca/share-path annotation is this share’s path. Each key mounts only its own share.
ErrorCause
Permission deniedThe share’s top directory is not owned by the user your Pod runs as (step 3), or the access rule is read-only.
Permission denied under a subPathThe sub-folder did not exist, so the kubelet created it owned by root (step 6). Change its owner from a VM.
Read-only file systemThe claim is ReadOnlyMany, or the volume is mounted with readOnly: true.