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-high
storage class definition (provisioner: blockvolume.csi.oraclecloud.com
).$ kubectl create -f csi-bvs-high.yaml
The following is the content of the
csi-bvs-high.yaml
file: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.yaml
The following is the content of the
csi-bvs-high-pvc.yaml
file:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mynginxclaim-high spec: storageClassName: "oci-bv-high" accessModes: - ReadWriteOnce resources: requests: storage: 50Gi
The persistent volume claim name in the
metadata
section 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
storage
property 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 4m
The PVC has a status of Pending because the
oci-bv-high
storage 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-high
PVC as thenginx
volume, 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-high
Run 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-high
Run the following command to verify that the pod is using the new PVC:
$ kubectl describe pod nginx-high