The page has been translated by Gen AI.

Using Block Storage storage classes

Deploying Pods and PVCs Using Storage Classes

You can deploy a pod and PVC that use bs-ssd by creating manifest files (for example, bs-pod.yaml and bs-pvc.yaml ).

Warning
  • The manifest file below is an example. * Modify key fields such as Image to match your 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 writing the 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 writing the 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 Run 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 the deployment results with the kubectl get pod,pvc command

Deploy Pods and PVCs to a specific AZ (allowedTopologies)

Users can create a separate storage class that includes the allowedTopologies setting to ensure that pods and volumes are deployed to a specific AZ.

Warning
  • We recommend creating additional storage classes by referring to the default bs-ssd storage class.
  • We recommend using “topology.bs.csi.samsungsdscloud.com/zone” for matchLabelExpressions. * (For all node Label settings)

Create the storage class 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 the PVC manifest file bs-az-a-sc.yaml

  1. Use the kubectl apply command to deploy the storage class, PVC, and pod manifests.
    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 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
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 the deployment results with the kubectl get pod,pvc command

Deploying Pods and PVCs 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. You can specify max_iops and max_throughput in the PVC creation annotations (priority 1) or in the StorageClass parameters (priority 2). The following example demonstrates both configurations. (If all are configured, the pvc Annotation value is applied.)

Warning
  • We recommend creating additional storage classes by referring to the default bs-ssd storage class.
  • If max_iops and max_throughput are not reflected, the PVC creation request will fail.

Create the storage class 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 creating the PVC manifest file bs-ssdprovisioned-sc.yaml

Create 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. Use the kubectl apply command to deploy the storage class, PVC, and pod manifests.

    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 using the kubectl apply command

  2. You can check the max-iops and max-throughput values of the created volume in the console under Virtual Server > Block Storage.

The following describes the max-iops and max-throughput PVC annotations.

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

Deploying a Replicated PVC Using volumeSnapshot

This guide explains how to clone and deploy a PVC using volumeSnapshot. The following example shows how to configure PVC replication using the default csi-bs-snapclass VolumeSnapshotClass.

Warning
  • The original PVC and the replica PVC must be in the same Namespace.
  • The related CRDs, volumesnapshotclass, snapshot controller, and so on are already deployed.
  1. Creates a volumeSnapshot for the original PVC.

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

  2. Verify that volumeSnapshotContent was created successfully. 2. (Snapshot content is auto-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 replicated PVC using 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

Deploying a PVC that uses the XFS file system

You can create a separate storage class that uses the XFS file system to format volumes provisioned with that storage class as XFS and mount them on the node.

Warning
  • We recommend creating additional storage classes by referring to the default bs-ssd storage class.
  • The default file system type for Block Storage CSI is ext4.

Create the storage class manifest file bs-xfs-sc.yaml .

Color mode
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssd-xfs
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD
  csi.storage.k8s.io/fstype: xfs
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: bs-ssd-xfs
provisioner: bs.csi.samsungsdscloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
  type: SSD
  csi.storage.k8s.io/fstype: xfs
Code block. Example of creating the PVC manifest file bs-xfs-sc.yaml

Create the PVC manifest file bs-xfs-pvc.yaml .

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

  1. Use the kubectl apply command to deploy the storage class, PVC, and pod manifests.
    Color mode
    kubectl apply -f bs-xfs-sc.yaml -f bs-xfs-pvc.yaml
    kubectl apply -f bs-xfs-sc.yaml -f bs-xfs-pvc.yaml
    Code block. Deploy the manifest using the kubectl apply command

kubectl get pod,pvc Run the command to verify the deployment results. Additionally, you can access the node and run the lsblk -f command to check the file system type of the mounted volume.

Color mode
# kubectl get pod,pvc
NAME         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
pvc-bs-xfs   Bound    pvc-9b1e7d34-5c82-4f6a-b3d0-1a7e48c2f905   8Gi        RWO            bs-ssd-xfs

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-xfs   Bound    pvc-9b1e7d34-5c82-4f6a-b3d0-1a7e48c2f905   8Gi        RWO            bs-ssd-xfs

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 the deployment results with the kubectl get pod,pvc command

Authentication and Authorization
Using the type LoadBalancer service