---
name: openshift-openshift_storage_odf_apps
title: Deploying an app on OpenShift Data Foundation
description: After you install the OpenShift Data Foundation add-on for your Red Hat&reg; OpenShift&reg; on IBM Cloud&reg; cluster, you can use the ODF storage classes to create a persistent volume claim (PVC). Then, refer to the PVC in your deployment so that your app can save and use data from the underlying ODF storage device.
last-updated: 2026-04-10
---

> ## Documentation Index
> The table of contents for this documentation set is at https://cloud.ibm.com/docs/openshift?format=markdown
> The index for all IBM Cloud docs is at: https://cloud.ibm.com/docs/llms.txt
> Use these files to discover more information as needed.

# Deploying an app on OpenShift Data Foundation
{: #odf-deploy-app}

After you install the OpenShift Data Foundation add-on for your Red Hat&reg; OpenShift&reg; on IBM Cloud&reg; cluster, you can use the ODF storage classes to create a persistent volume claim (PVC). Then, refer to the PVC in your deployment so that your app can save and use data from the underlying ODF storage device.
{: shortdesc}

Minimum required permissions
:   **Editor** platform access role and the **Writer** service access role for the cluster in IBM Cloud Kubernetes Service.

[Access your Red Hat OpenShift cluster](https://cloud.ibm.com/docs/openshift?topic=openshift-access_cluster&format=markdown).

1. List the ODF storage classes. For more information about ODF storage classes, see the [Storage class reference](https://cloud.ibm.com/docs/openshift?topic=openshift-ocs-sc-ref&format=markdown#ocs-sc-ref).
    ```sh
    oc get sc | grep openshift
    ```
    {: pre}

    Example output
    ```sh
    NAME                   PROVISIONER            RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
    Immediate              true                   9m19s
    ocs-storagecluster-ceph-rbd                   openshift-storage.rbd.csi.ceph.com      Delete          Immediate              false                  9m19s
    ocs-storagecluster-ceph-rgw                   openshift-storage.ceph.rook.io/bucket   Delete          Immediate              false                  18m
    ocs-storagecluster-cephfs                     openshift-storage.cephfs.csi.ceph.com   Delete          Immediate              true                   10m
    openshift-storage.noobaa.io                   openshift-storage.noobaa.io/obc         Delete          Immediate              false                  6m32s
    ```
    {: screen}


1. Create a PVC that refers to the storage class that you want to use. Save and edit the following PVC configuration file to refer to the storage class that you want to use. If you enabled encryption with Hyper Protect Crypto Services, you can use the storage class `ocs-storagecluster-ceph-rbd-encrypted`, which supports encryption.
    **Example PVC for using the `ocs-storagecluster-cephfs` storage class.**
    ```yaml
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: odf-pvc
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: ocs-storagecluster-cephfs
    ```
    {: codeblock}

1. Create the PVC in your cluster.
    ```sh
    oc create -f <my-pvc.yaml>
    ```
    {: pre}

1. Create a YAML configuration file for a pod that mounts the PVC that you created. The following example creates an `nginx` pod that writes the current date and time to a `test.txt` file.
    ```yaml
    apiVersion: v1
    kind: Pod
    metadata:
      name: app
    spec:
      containers:
      - name: app
        image: nginx
        command: ["/bin/sh"]
        args: ["-c", "while true; do echo $(date -u) >> /test/test.txt; sleep 600; done"]
        volumeMounts:
        - name: persistent-storage
          mountPath: /test
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: odf-pvc
    ```
    {: codeblock}

1. Create the pod in your cluster.
    ```sh
    oc apply -f pod.yaml
    ```
    {: pre}

1. To verify that the pod is deployed, wait for your app to get into a `Running` status.
    ```sh
    oc get pods
    ```
    {: pre}

    Example output

    ```sh
    NAME                                READY   STATUS    RESTARTS   AGE
    app                                 1/1     Running   0          2m58s
    ```
    {: screen}

1. Verify that the app can write data.
    1. Log in to your pod.
        ```sh
        oc exec <app-pod-name> -it -- bash
        ```
        {: pre}

    1. Display the contents of the `test.txt` file to confirm that your app can write data to your persistent storage.
        ```sh
        cat /test/test.txt
        ```
        {: pre}

        Example output
        ```sh
        Tue Mar 2 20:09:19 UTC 2021
        Tue Mar 2 20:09:25 UTC 2021
        Tue Mar 2 20:09:31 UTC 2021
        Tue Mar 2 20:09:36 UTC 2021
        Tue Mar 2 20:09:42 UTC 2021
        Tue Mar 2 20:09:47 UTC 2021
        ```
        {: screen}

    1. Exit the pod.
        ```sh
        exit
        ```
        {: pre}