The page has been translated by Gen AI.

Using the Block Storage storage class

Deploying Pods and PVCs Using Storage Classes

매니페스트 파일(예시: bs-pod.yamlbs-pvc.yaml )을 작성하여 bs-ssd를 사용하는 Pod와 Pvc를 배포할 수 있습니다.

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

Follow these steps to create a Pod and PVC using the bs-ssd storage class.

  1. Pvc 매니페스트 파일 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

  2. Pod 매니페스트 파일 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 a Service manifest file bs-pod.yaml

  3. 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 with the kubectl apply command.

  4. kubectl get pod,pvc 명령어를 사용하여 배포 결과를 확인합니다.

    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)

A 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)
  1. storageclass 매니페스트 파일 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 writing a Pvc manifest file bs-az-a-sc.yaml

  2. 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 the manifest with the kubectl apply command.

  3. kubectl get pod,pvc 명령어를 사용하여 배포 결과를 확인합니다.

    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.

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. max_iops and max_throughput can be specified in the storage class parameters (2nd priority) of the created PVC Annotation (1st priority). The example below demonstrates a case that incorporates both settings. (If all are set, 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.
  1. storageclass 매니페스트 파일 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   # Volume type change (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   # Volume type change (SSD > SSD_Provisioned)
      max_iops: "17000"       # max_iops setting (5000-20000)
      max_throughput: "250"   # max_throughput setting (250-1000)
    Code block. Example of creating a PVC manifest file bs-ssdprovisioned-sc.yaml

  2. Pvc 매니페스트 파일 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 a PVC manifest file bs-ssdprovisioned-pvc.yaml

  3. 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.

  4. 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.

AnnotationEssentialDefaultScopeExplanation
bs.csi.samsungscloud.com/max-iopsOptional-5000-20000IOPS value set when creating the service
bs.csi.samsungscloud.com/max-throughputOptional-250-1000Throughput speed (MB/s) set when creating the service
Table. Firewall-related settings in Kubernetes annotations
Using type LoadBalancer service
Usage Considerations