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-rbd for ODF or ocs-storagecluster-ceph-rbd for 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

  1. 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"
  2. 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"
  3. 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
    EOF
    Note: Replace ocs-storagecluster-odf-ceph-rbd with your storage class name (for example, ocs-storagecluster-ceph-rbd for FDF). Adjust the storage size according to your workload requirements. The volumeMode: Block setting is required for encrypted storage with IBM Confidential Computing Containers contracts.
  4. Apply the PersistentVolumeClaim to the cluster:
    oc apply -f storage-pvc1.yaml

    The storage cluster will automatically create the corresponding PersistentVolume when a pod claiming this PVC is launched.

  5. 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   5s
    Note: The PVC status will remain Pending until a pod claims it. This is expected behavior.
  6. 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)

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.