Creating PersistentVolumeClaims for storage
This step must be performed by the Data Owner.
About PersistentVolumeClaims
A PersistentVolumeClaim (PVC) is a request for storage by a user. The storage cluster automatically creates the corresponding PersistentVolume when a pod claiming the PVC is launched. For contracts with volumes, you must create PVCs before configuring the contract.
Prerequisites
- You have the storage class name from the Environment Operator (for example,
ocs-storagecluster-odf-ceph-rbdfor ODF orocs-storagecluster-ceph-rbdfor FDF). - You have determined the storage requirements for your workload in consultation with the Solution Provider.
- You have access to create resources in the target namespace.
Procedure
- Define a unique name for your PersistentVolumeClaim.
Ensure the PVC name is not already in use in your namespace.
export STORAGE_PVC_NAME="sample-pvc-1" - Define a device name for the volume.
This device name will be used in the contract to reference the volume. Coordinate with the Solution Provider to agree on the device naming convention.
export DEVICE_NAME="pvb_storage" - Create a PVC YAML file with the following content:
cat << EOF > storage-pvc1.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ${STORAGE_PVC_NAME} namespace: default spec: accessModes: - ReadWriteOnce storageClassName: ocs-storagecluster-odf-ceph-rbd volumeMode: Block resources: requests: storage: 2Gi EOFNote: Replaceocs-storagecluster-odf-ceph-rbdwith your storage class name (for example,ocs-storagecluster-ceph-rbdfor FDF). Adjust thestoragesize according to your workload requirements. ThevolumeMode: Blocksetting is required for encrypted storage with IBM Confidential Computing Containers contracts. - Apply the PersistentVolumeClaim to the cluster:
oc apply -f storage-pvc1.yamlThe storage cluster will automatically create the corresponding PersistentVolume when a pod claiming this PVC is launched.
- Verify the PVC was created successfully:
oc get pvc ${STORAGE_PVC_NAME}Example output:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE sample-pvc-1 Pending ocs-storagecluster-odf-ceph-rbd 5sNote: The PVC status will remainPendinguntil a pod claims it. This is expected behavior. - Share the following information with the Solution Provider:
- PVC name: Value of
STORAGE_PVC_NAME(for example,sample-pvc-1) - Device name: Value of
DEVICE_NAME(for example,pvb_storage)
- PVC name: Value of
Creating multiple volumes
To create multiple volumes for a workload, repeat the procedure with different PVC names and device names. For example:
export STORAGE_PVC_NAME="sample-pvc-2"
export DEVICE_NAME="pvb_storage2"
Ensure each PVC and device name is unique within your namespace and contract.
Next steps
After creating the PVC, the Solution Provider can proceed to configure volumes in the workload section of the contract.