Integrate with Container Storage Interface (CSI)
To integrate CSI with Kubernetes cluster, follow these steps:
Prepare
Create a Kubernetes cluster on GreenNode, 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 GreenNode BlockStorage CSI Driver
Attention:
When you initialize the Cluster according to the instructions above, if you have not enabled the Enable BlockStore Persistent Disk CSI Driver option , by default we will not pre-install this plugin into your Cluster. You need to manually create Service Account and install GreenNode BlockStorage CSI Driver according to the instructions below. If you have enabled the Enable BlockStore Persistent Disk CSI Driver option , we have pre-installed this plugin into your Cluster, skip the Service Account Initialization step, install GreenNode BlockStorage CSI Driver and continue following the instructions from now on. Deploy a Workload.
GreenNode BlockStorage CSI Driver only supports attaching volumes to a single node (VM) throughout the life of that volume. If you have a need for ReadWriteMany, you may consider using the NFS CSI Driver, as it allows multiple nodes to Read and Write on the same volume at the same time. This is very useful for applications that need to share data between multiple pods or services in Kubernetes.
Create Service Account and install GreenNode BlockStorage CSI Driver
Initialize Service Account
Create or use a service account created on IAM and attach policy: vServerFullAccess . To create a service account, go here and follow these steps:
Select " Create a Service Account ", enter a name for the Service Account and click Next Step to assign permissions to the Service Account
Find and select Policy: vServerFullAccess , then click " Create a Service Account " to create a Service Account, Policy: vLBFullAccess and Policy: vServerFullAccess are created by GreenNode, you cannot delete these policies.
After successful creation, you need to save the Client_ID and Secret_Key of the Service Account to perform the next step.
Install GreenNode BlockStorage CSI Driver
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:
helm repo add vks-helm-charts https://vngcloud.github.io/vks-helm-charts helm repo updateReplace your K8S cluster's ClientID, Client Secret, and ClusterID information and continue running:
Copy
helm install vngcloud-blockstorage-csi-driver vks-helm-charts/vngcloud-blockstorage-csi-driver \ --replace --namespace kube-system \ --set vngcloudAccessSecret.keyId=${VNGCLOUD_CLIENT_ID} \ --set vngcloudAccessSecret.accessKey=${VNGCLOUD_CLIENT_SECRET} \ --set vngcloudAccessSecret.vksClusterId=${VNGCLOUD_VKS_CLUSTER_ID} # OptionalAfter the installation is complete, check the status of vngcloud-blockstorage-csi-driver pods:
kubectl get pods -n kube-system | grep vngcloud-csi-For example, in the image below you have successfully installed vngcloud-blockstorage-csi-driver:
NAME READY STATUS RESTARTS AGE vngcloud-csi-controller-56bd7b85f-ctpns 7/7 Running 6 (2d4h ago) 2d4h vngcloud-csi-controller-56bd7b85f-npp9n 7/7 Running 2 (2d4h ago) 2d4h vngcloud-csi-node-c8r2w 3/3 Running 0 2d4h
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 GreenNode 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
Attention:
You can only increase Disk Volume but cannot reduce Disk Volume size.
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

