Skip to content

Commit

Permalink
[docs] update the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongpiger committed Dec 29, 2023
1 parent 3521d05 commit cbd39e8
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 2 deletions.
50 changes: 50 additions & 0 deletions manifests/block-volume/block-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
####################################################################################################
# Author: Cuong. Duong Manh <[email protected]>
# Description: This is an example of using block volume
# This example will create a StorageClass, a PVC and a Pod
# The Pod will use the PVC to mount a block volume to /var/lib/www/html
# The Pod will use nginx image to serve the content of the block volume
####################################################################################################

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: my-storage-class # [1] The StorageClass name, CAN be changed
provisioner: csi.vngcloud.vn # The CSI driver name
parameters:
type: vtype-6790f903-38d2-454d-919e-5b49184b5927 # Change it to your volume type UUID or name
---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc # [2] The PVC name, CAN be changed
spec:
accessModes:
- ReadWriteOnce # MUST set this value, currently only support RWO
resources:
requests:
storage: 20Gi # [3] The PVC size, CAN be changed, this value MUST be in the valid range of the proper volume type
storageClassName: my-storage-class # MUST be same value with [1], not set this value will use default StorageClass
---

apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- mountPath: /var/lib/www/html # The mount path in container, CAN be changed
name: my-volume-name # MUST be same value with [4]
volumes:
- name: my-volume-name # [4] The volume mount name, CAN be changed
persistentVolumeClaim:
claimName: my-pvc # MUST be same value with [2]
readOnly: false
3 changes: 2 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- [Overview](helm-charts/vcontainer-storage-interface/overview.md)
- [Installation](helm-charts/vcontainer-storage-interface/installation.md)
- [For usage](helm-charts/vcontainer-storage-interface/example.md)
- [`StorageClass` based on Volume Type](helm-charts/vcontainer-storage-interface/example/volume-type.md)
- [`StorageClass` based on Volume Type](helm-charts/vcontainer-storage-interface/example/volume-type.md)
- [Block volume](helm-charts/vcontainer-storage-interface/example/block-volume.md)
3 changes: 2 additions & 1 deletion src/helm-charts/vcontainer-storage-interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- [Overview](overview.md)
- [Installation](installation.md)
- [For usage](example.md)
- [`StorageClass` based on Volume Type](example/volume-type.md)
- [`StorageClass` based on Volume Type](example/volume-type.md)
- [Block volume](example/block-volume.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<div style="float: right;"><img src="../../../images/01.png" width="160px" /></div><br>


# Block volume
The following manifest will first create a `StorageClass` named `my-storage-class` and subsequently generate a `PersistentVolumeClaim` named `my-pvc`. Finally, it will deploy an `nginx` `Pod` utilizing the aforementioned `PersistentVolumeClaim`:

***File [block-volume.yaml](https://github.com/vngcloud/vcontainer-helm-infra-documentation/manifests/block-volume/block-volume.yaml)***
```yaml=
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: my-storage-class # [1] The StorageClass name, CAN be changed
provisioner: csi.vngcloud.vn # The CSI driver name
parameters:
type: vtype-6790f903-38d2-454d-919e-5b49184b5927 # Change it to your volume type UUID from portal
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc # [2] The PVC name, CAN be changed
spec:
accessModes:
- ReadWriteOnce # MUST set this value, currently only support RWO
resources:
requests:
storage: 20Gi # [3] The PVC size, CAN be changed, this value MUST be in the valid range of the proper volume type
storageClassName: my-storage-class # MUST be same value with [1], not set this value will use default StorageClass
---
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- mountPath: /var/lib/www/html # The mount path in container, CAN be changed
name: my-volume-name # MUST be same value with [4]
volumes:
- name: my-volume-name # [4] The volume mount name, CAN be changed
persistentVolumeClaim:
claimName: my-pvc # MUST be same value with [2]
readOnly: false
```

Apply the manifest:
```bash=
kubectl apply -f block-volume.yaml
```

<center>

![](./../../../images/17.png)

</center>

Verify the associated resources within a few seconds:
```bash=
kubectl get sc,pvc,pod -owide
```

<center>

![](./../../../images/18.png)

</center>

Users also can verify this `PersistentVolumeClaim` on the **VNG CLOUD portal**:

<center>

![](./../../../images/19.png)

</center>
Binary file added src/images/17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbd39e8

Please sign in to comment.