Creating Persistent High Performance Block Volume Storage
This procedure creates a high performance block volume as persistent storage on Compute Cloud@Customer.
If you don't need a high performance block volume, use the instructions in Creating Persistent Block Volume Storage.
-
Create a high performance block volume using the CSI plugin specified by the
oci-bv-highstorage class definition (provisioner: blockvolume.csi.oraclecloud.com).$ kubectl create -f csi-bvs-high.yamlThe following is the content of the
csi-bvs-high.yamlfile:apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: oci-bv-high provisioner: blockvolume.csi.oraclecloud.com parameters: vpusPerGB: "20" attachment-type: "paravirtualized" volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true reclaimPolicy: Delete -
Create a persistent volume claim, specifying the storage class name
oci-bv-high.$ kubectl create -f csi-bvs-high-pvc.yamlThe following is the content of the
csi-bvs-high-pvc.yamlfile:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mynginxclaim-high spec: storageClassName: "oci-bv-high" accessModes: - ReadWriteOnce resources: requests: storage: 50GiThe persistent volume claim name in the
metadatasection is user-specified. You can have more than one persistent volume claim on a persistent volume.For the value of
accessModes, specifyReadWriteOnce; do not useReadWriteMany.The value of the
storageproperty must be at least 50 gigabytes. -
Run the following command to verify that the PVC has been created:
$ kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE mynginxclaim-high Pending oci-bv-high 4mThe PVC has a status of Pending because the
oci-bv-highstorage class definition includes the following:volumeBindingMode: WaitForFirstConsumer -
Use the PVC when creating other objects, such as pods.
For example, you could create a new pod from the following pod definition, which instructs the system to use the
mynginxclaim-highPVC as thenginxvolume, which is mounted by the pod at/data:apiVersion: v1 kind: Pod metadata: name: nginx-high spec: containers: - name: nginx image: nginx:latest ports: - name: http containerPort: 80 volumeMounts: - name: data mountPath: /usr/share/nginx/html volumes: - name: data persistentVolumeClaim: claimName: mynginxclaim-highRun the following command to verify that the PVC has been bound to a new PV:
$ kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE mynginxclaim-high Bound csi-unique_ID 50Gi RWO oci-bv-highRun the following command to verify that the pod is using the new PVC:
$ kubectl describe pod nginx-high