The page has been translated by Gen AI.

Using Block Storage storage class

Deploy pod and pvc using storage class

Create a manifest file (example: bs-pod.yaml and bs-pvc.yaml ) to deploy a pod and PVC that use bs-ssd.

Caution
  • The manifest file below is an example. * Please adjust key fields, such as Image, to match the user’s environment.

To create a pod and pvc using the bs-ssd storage class, follow these steps.

Create the PVC manifest file bs-pvc.yaml .

Color mode
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-bs-ssd
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: bs-ssd
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-bs-ssd
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: bs-ssd
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi
Code block. Example of creating a pvc manifest file bs-pvc.yaml

Create the pod manifest file bs-pod.yaml .

Color mode
kind: Pod
apiVersion: v1
metadata:
  name: pod-bs-ssd
spec:
  containers:
    - name: busybox
      image: busybox:latest
      command:
        - sleep
        - 3600
      volumeMounts:
      - mountPath: "/data"
        name: my-csi-volume
  volumes:
    - name: my-csi-volume
      persistentVolumeClaim:
        claimName: pvc-bs-ssd
kind: Pod
apiVersion: v1
metadata:
  name: pod-bs-ssd
spec:
  containers:
    - name: busybox
      image: busybox:latest
      command:
        - sleep
        - 3600
      volumeMounts:
      - mountPath: "/data"
        name: my-csi-volume
  volumes:
    - name: my-csi-volume
      persistentVolumeClaim:
        claimName: pvc-bs-ssd
Code block. Example of creating a Service manifest file bs-pod.yaml

  1. Deploy the pvc and pod manifests using the kubectl apply command.
    Color mode
    kubectl apply -f bs-pvc.yaml -f bs-pod.yaml
    kubectl apply -f bs-pvc.yaml -f bs-pod.yaml
    Code block. Deploy the manifest using the kubectl apply command

kubectl get pod,pvc use the command to verify the deployment results.

Color mode
# kubectl get pod,pvc
NAME                               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
persistentvolumeclaim/pvc-bs-ssd   Bound    pvc-5a085a06-164f-45e1-b4c6-d2bfa3b0012c   8Gi        RWO            bs-ssd

NAME             READY   STATUS    RESTARTS   AGE
pod/pod-bs-ssd   1/1     Running   0          75s
# kubectl get pod,pvc
NAME                               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
persistentvolumeclaim/pvc-bs-ssd   Bound    pvc-5a085a06-164f-45e1-b4c6-d2bfa3b0012c   8Gi        RWO            bs-ssd

NAME             READY   STATUS    RESTARTS   AGE
pod/pod-bs-ssd   1/1     Running   0          75s
Code block. Check deployment results with the kubectl get pod,pvc command.

Deploy pod and pvc to a specific AZ (allowedTopologies)

The user can create a separate storage class that includes the allowedTopologies setting, enabling pods and volumes to be scheduled to a specific AZ.

Caution
  • Based on the default deployed bs-ssd storage class, we recommend creating additional storage classes.
  • It is recommended to use “topology.bs.csi.samsungsdscloud.com/zone” with matchLabelExpressions. * (Label not applied to all nodes)

Create the storageclass manifest file bs-az-a-sc.yaml .

Color mode
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssd-az-a
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD
allowedTopologies:
- matchLabelExpressions:
  - key: topology.bs.csi.samsungsdscloud.com/zone
    values:
    - kr-west1-a
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssd-az-a
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD
allowedTopologies:
- matchLabelExpressions:
  - key: topology.bs.csi.samsungsdscloud.com/zone
    values:
    - kr-west1-a
Code block. Example of creating a PVC manifest file bs-az-a-sc.yaml

  1. Deploy the storageclass, pvc, and pod manifests using the kubectl apply command.
    Color mode
    kubectl apply -f bs-az-a-sc.yaml -f bs-pvc.yaml -f bs-pod.yaml
    kubectl apply -f bs-az-a-sc.yaml -f bs-pvc.yaml -f bs-pod.yaml
    Code block. Deploy manifest with the kubectl apply command

Check the deployment result using the kubectl get pod,pvc command.

Color mode
# kubectl get pod,pvc
NAME         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
pvc-bs-ssd   Bound    pvc-42365cee-724c-446a-af35-e54d9b16ad51   8Gi        RWO            bs-ssd-az-a

NAME         READY   STATUS       RESTARTS   AGE   IP       	 NODE
pod-bs-ssd   1/1     Running	  0          46s   172.21.52.3   ske-aaa-lrwdj-vwww2
# kubectl get pod,pvc
NAME         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
pvc-bs-ssd   Bound    pvc-42365cee-724c-446a-af35-e54d9b16ad51   8Gi        RWO            bs-ssd-az-a

NAME         READY   STATUS       RESTARTS   AGE   IP       	 NODE
pod-bs-ssd   1/1     Running	  0          46s   172.21.52.3   ske-aaa-lrwdj-vwww2
Code block. Check deployment results with the kubectl get pod,pvc command.

Deploy pod and PVC using the ssd_provisioned volume type

Users can specify the max_iops and max_throughput of a volume created using the SSD_Provisioned volume type. max_iops and max_throughput can be set in the created PVC annotation (first priority) or in the storage class parameters (second priority). The example below shows a case that reflects both settings. (If all are configured, the pvc Annotation value is applied.)

Caution
  • Based on the default deployed bs-ssd storage class, we recommend creating additional storage classes.
  • If max_iops and max_throughput are not applied, the PVC creation request will fail.

Create the storageclass manifest file bs-ssdprovisioned-sc.yaml .

Color mode
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssdprovisioned-sc
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD_Provisioned   # change volume type (SSD > SSD_Provisioned)
  max_iops: "17000"       # max_iops setting (5000-20000)
  max_throughput: "250"   # max_throughput setting (250-1000)
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssdprovisioned-sc
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD_Provisioned   # change volume type (SSD > SSD_Provisioned)
  max_iops: "17000"       # max_iops setting (5000-20000)
  max_throughput: "250"   # max_throughput setting (250-1000)
Code block. Example of writing the PVC manifest file bs-ssdprovisioned-sc.yaml

Write the pvc manifest file bs-ssdprovisioned-pvc.yaml .

Color mode
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-bs-ssdprovisioned
  annotations:
    "bs.csi.samsungsdscloud.com/max-iops": "5000"       # max_iops setting
    "bs.csi.samsungsdscloud.com/max-throughput": "250"  # max_throughput setting
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: bs-ssdprovisioned-sc
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-bs-ssdprovisioned
  annotations:
    "bs.csi.samsungsdscloud.com/max-iops": "5000"       # max_iops setting
    "bs.csi.samsungsdscloud.com/max-throughput": "250"  # max_throughput setting
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: bs-ssdprovisioned-sc
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi
Code block. Example of creating the PVC manifest file bs-ssdprovisioned-pvc.yaml

  1. Deploy the storageclass, pvc, and pod manifests using the kubectl apply command.

    Color mode
    kubectl apply -f bs-ssdprovisioned-sc.yaml -f bs-ssdprovisioned-pvc.yaml -f bs-pod.yaml
    kubectl apply -f bs-ssdprovisioned-sc.yaml -f bs-ssdprovisioned-pvc.yaml -f bs-pod.yaml
    Code block. Deploy the manifest with the kubectl apply command.

  2. The max‑iops and max‑throughput values of the created volume can be viewed in the console under Virtual Server > Block Storage.

Below is an explanation of the max-iops and max-throughput PVC annotations.

AnnotationrequireddefaultrangeExplanation
bs.csi.samsungsdscloud.com/max-iopsOptional-5000-20000IOPS value set when creating the service
bs.csi.samsungscloud.com/max-throughputOptional-250-1000Throughput rate (MB/s) set when creating the service
Table. Firewall-related settings in Kubernetes annotations

Deploy replicated PVC using volumeSnapshot

This is a guide for cloning and deploying pvc using volumeSnapshot. The example below shows a PVC replication configuration using the built-in csi-bs-snapclass VolumeSnapshotClass.

Caution
  • The original PVC and the replica PVC must be located in the same Namespace.
  • The related CRD, volumesnapshotclass, snapshot controller, etc., have already been deployed.
  1. Create a volumeSnapshot that targets the original PVC.

    Color mode
    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
      name: bs-snapshot-test
    spec:
      volumeSnapshotClassName: csi-bs-snapclass           # volumesnapshotclass to use
      source:
        persistentVolumeClaimName: pvc-bs-original-test   # original PVC
    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
      name: bs-snapshot-test
    spec:
      volumeSnapshotClassName: csi-bs-snapclass           # volumesnapshotclass to use
      source:
        persistentVolumeClaimName: pvc-bs-original-test   # original PVC
    Code block. Example of writing volumeSnapshot.yaml

  2. Verify that the volumeSnapshotContent was created correctly. 2. (snapshot content is automatically generated)

    Color mode
    $ kubectl get volumesnapshotcontent -owide
    NAME              READYTOUSE   RESTORESIZE    DELETIONPOLICY   DRIVER                       VOLUMESNAPSHOTCLASS    VOLUMESNAPSHOT     VOLUMESNAPSHOTNAMESPACE   AGE
    snapcontent-xxx   true         111669149696   Delete           bs.csi.samsungsdscloud.com   csi-bs-snapclass       bs-snapshot-test   default                   23s
    $ kubectl get volumesnapshotcontent -owide
    NAME              READYTOUSE   RESTORESIZE    DELETIONPOLICY   DRIVER                       VOLUMESNAPSHOTCLASS    VOLUMESNAPSHOT     VOLUMESNAPSHOTNAMESPACE   AGE
    snapcontent-xxx   true         111669149696   Delete           bs.csi.samsungsdscloud.com   csi-bs-snapclass       bs-snapshot-test   default                   23s
    Code block. Example of writing volumeSnapshot.yaml

  3. Create a cloned PVC using a volumeSnapshot.

    Color mode
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: pvc-bs-restored-test
    spec:
      accessModes:
        - ReadWriteOnce
      storageClassName: bs-ssd
      dataSource:
        name: bs-snapshot-test              # created volumeSnapshot
        kind: volumeSnapshot
        apiGroup: snapshot.storage.k8s.io
      volumeMode: Filesystem
      resources:
        requests:
          storage: 120Gi
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: pvc-bs-restored-test
    spec:
      accessModes:
        - ReadWriteOnce
      storageClassName: bs-ssd
      dataSource:
        name: bs-snapshot-test              # created volumeSnapshot
        kind: volumeSnapshot
        apiGroup: snapshot.storage.k8s.io
      volumeMode: Filesystem
      resources:
        requests:
          storage: 120Gi
    Code block. Example of writing volumeSnapshot.yaml

Using the type LoadBalancer service
Usage Considerations