Skip to content

Persistent Volumes & Storage Claims

By default, container filesystems are ephemeral. To store research inputs, beamline raw data, and trained model weights, you must create a PersistentVolumeClaim (PVC).

1. Creating a CephFS PersistentVolumeClaim

Section titled “1. Creating a CephFS PersistentVolumeClaim”

CephFS provides a POSIX-compliant distributed filesystem that supports ReadWriteMany (RWX), allowing hundreds of pods to read and write to the same volume simultaneously.

Create cephfs-claim.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: lab-shared-data-pvc
namespace: sci-myproject
spec:
accessModes:
- ReadWriteMany
storageClassName: cephfs-sc
resources:
requests:
storage: 500Gi

Apply the claim:

Terminal window
kubectl apply -f cephfs-claim.yaml
kubectl get pvc -n sci-myproject

apiVersion: v1
kind: Pod
metadata:
name: analysis-worker
namespace: sci-myproject
spec:
containers:
- name: app
image: python:3.11-slim
command: ["bash", "-c", "echo 'Experiment data logged' >> /mnt/shared/results.log && sleep 3600"]
volumeMounts:
- name: dataset-mount
mountPath: /mnt/shared
volumes:
- name: dataset-mount
persistentVolumeClaim:
claimName: lab-shared-data-pvc