Integrate with Container Storage Interface (CSI)
To integrate CSI with Kubernetes cluster, follow these steps:
Prepare
Create a Kubernetes cluster on VNGCloud, or use an existing cluster. Note: make sure you have downloaded the cluster configuration file once the cluster has been successfully initialized and accessed your cluster.
Create Service Account and install VNGCloud BlockStorage CSI Driver
Deploy a Workload
The following is a guide for you to deploy the nginx service on Kubernetes.
Step 1 : Create Deployment for Nginx app.
Create nginx-service.yaml file with the following content:
Deploy This deployment equals:
Step 2: Check the Deployment and Service information just deployed
Run the following command to test Deployment
If the results are returned as below, it means you have deployed Deployment successfully.
Create Persistent Volume
Create a persistent-volume.yaml file with the following content:
Copy
Run the following command to deploy a Pod using a Persistent Volume
Copy
At this time, the vServer system will automatically create a Volume corresponding to the yaml file above, for example:

Create Snapshots
Snapshot is a low-cost, convenient and effective data backup method and can be used to create images, restore data and distribute copies of data. If you are a new user who has never used the Snapshot service, you will need to Activate Snapshot Service before you can create a Snapshot for your Persistent Volume.
Activate Snapshot Service
To be able to create Snapshots, you need to perform Activate Snapshot Service. You will not be charged for activating the snapshot service. After you create snapshots, costs will be calculated based on the storage capacity and storage time of these snapshots. Follow these steps to enable the Snapshot service:
Step 1: Visit https://hcm-3.console.vngcloud.vn/vserver/block-store/snapshot/overview
Step 2: Select Activate Snapshot Service .
For example:

Install VNGCloud Snapshot Controller
Install Helm version 3.0 or higher. Refer to https://helm.sh/docs/intro/install/ for instructions on how to install.
Add this repo to your cluster via the command:
Continue running:
After the installation is complete, check the status of vngcloud-blockstorage-csi-driver pods:
For example, in the image below you have successfully installed vngcloud-snapshot-controller:
Create a snapshot.yaml file with the following content
Run the following command to deploy Volume Snapshot
Check the newly created PVC and Snapshot
After applying the file successfully, you can check the service and pvc list via:
Change the IOPS parameters of the newly created Persistent Volume
To change the IOPS parameters of the newly created Persistent Volume, follow these steps:
Step 1: Run the command below to list the PVCs in your Cluster
Step 2: Edit the PVC YAML file according to the command
If you have not edited the IOPS of the Persistent Volume before, when you run the above command, add an annotation bs.csi.vngcloud.vn/volume-type: "volume-type-id" . For example, below I am changing the Persistent Volume IOPS from 200 (Volume type id = vtype-61c3fc5b-f4e9-45b4-8957-8aa7b6029018) to 1000 (Volume type id = vtype-85b39362-a360-4bbb-9afa-a36a40cea748 )
Copy
If you have edited the IOPS of the Persistent Volume before, when you run the above command, your yaml file will already have the annotation bs.csi.vngcloud.vn/volume-type: "volume-type-id" . Now, edit this annotation to the Volume type id with the IOPS you desire.
Change the Disk Volume of the newly created Persistent Volume
To change the Disk Volume of the newly created Persistent Volume, run the following command:
For example, initially the PVC created was 20 Gi in size, now I will increase it to 30 Gi
Restore Persistent Volume from Snapshot
To restore Persistent Volume from Snapshot, follow these steps:
Create file restore-volume.yaml with the following content:
Copy
Last updated

