第 9 章 Managing Persistent Volume Claims
Follow the instructions in this section to configure OpenShift Data Foundation as storage for an application pod.
Prerequisites
- Administrative access to OpenShift Web Console.
-
OpenShift Data Foundation Operator is installed and running in the
openshift-storagenamespace. In OpenShift Web Console, click OperatorsInstalled Operators to view installed operators. -
The default storage classes provided by OpenShift Data Foundation are available. In OpenShift Web Console, click Storage
StorageClasses to view default storage classes.
Procedure
Create a Persistent Volume Claim (PVC) for the application to use.
-
In OpenShift Web Console, click Storage
Persistent Volume Claims. - Set the Project for the application pod.
Click Create Persistent Volume Claim.
- Specify a Storage Class provided by OpenShift Data Foundation.
-
Specify the PVC Name, for example,
myclaim. Select the required Access Mode.
注意The Access Mode,
Shared access (RWX)is not supported in IBM FlashSystem.-
For Rados Block Device (RBD), if the Access mode is ReadWriteOnce (
RWO), select the required Volume mode. The default volume mode isFilesystem. - Specify a Size as per application requirement.
-
Click Create and wait until the PVC is in
Boundstatus.
-
In OpenShift Web Console, click Storage
Configure a new or existing application pod to use the new PVC.
For a new application pod, perform the following steps:
- Click Workloads →Pods.
- Create a new application pod.
Under the
spec:section, addvolumes:section to add the new PVC as a volume for the application pod.volumes: - name: <volume_name> persistentVolumeClaim: claimName: <pvc_name>For example:
volumes: - name: mypd persistentVolumeClaim: claimName: myclaim
For an existing application pod, perform the following steps:
- Click Workloads →Deployment Configs.
- Search for the required deployment config associated with the application pod.
-
Click on its Action menu (⋮)
Edit Deployment Config. Under the
spec:section, addvolumes:section to add the new PVC as a volume for the application pod and click Save.volumes: - name: <volume_name> persistentVolumeClaim: claimName: <pvc_name>For example:
volumes: - name: mypd persistentVolumeClaim: claimName: myclaim
Verify that the new configuration is being used.
-
Click Workloads
Pods. - Set the Project for the application pod.
-
Verify that the application pod appears with a status of
Running. - Click the application pod name to view pod details.
-
Scroll down to Volumes section and verify that the volume has a Type that matches your new Persistent Volume Claim, for example,
myclaim.
-
Click Workloads