IBM Cloud의 Storage 종류
Access Modes 에 "ReadWriteOne" 가능
Storage 공유 불가
Access Modes 에 "ReadWriteMany" 가능
Pods이 여러개 뜰 경우 storage 공유 가능
등급
- bronze~gold : 고정적인 IOPS로 Storage Size 선택
- custom : Storage Size 및 Size에 맞는 IOPS선택
bronze | silver | gold | custom | |
---|---|---|---|---|
iopsPerGB | 2 | 4 | 10 | |
sizeRange | [20-12000]Gi | [20-12000]Gi | [20-4000]Gi | |
sizeIOPSRange | [20-39]Gi : [100-1000] |
빌링
- monthly 또는 hourly (임시 테스트 생성 시 hourly 사용 권장)
persistentVolume Reclaim Policy 값
ibmc-block-{등급} : "delete"
ibmc-block-retain-{등급} : "retain"
생성 예시
ibmc-block-retain-silver
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-myapp annotations: volume.beta.kubernetes.io/storage-class: "ibmc-block-retain-silver" labels: billingType: "monthly" spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi
ibmc-block-retain-custom
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-myapp annotations: volume.beta.kubernetes.io/storage-class: "ibmc-block-retain-custom" labels: billingType: "monthly" spec: accessModes: - ReadWriteOnce # file storage인 경우에는 - ReadWriteMany resources: requests: storage: 20Gi iops: "1000"
생성된 PVC 를 Deployment 에 마운트
apiVersion: apps/v1 kind: Deployment metadata: name: <deployment_name> labels: app: <deployment_label> spec: selector: matchLabels: app: <app_name> template: metadata: labels: app: <app_name> spec: containers: - image: <image_name> name: <container_name> volumeMounts: - name: <volume_name> mountPath: /<file_path> volumes: - name: <volume_name> persistentVolumeClaim: claimName: <pvc_name>
생성된 PVC 를 StatefulSet 에 마운트
apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 3 podManagementPolicy: "Parallel" selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - nginx topologyKey: failure-domain.beta.kubernetes.io/zone containers: - name: nginx image: k8s.gcr.io/nginx-slim:0.8 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html - name: wwwww mountPath: /tmp1 volumeClaimTemplates: - metadata: name: myvol1 spec: accessModes: - ReadWriteMany # access mode resources: requests: storage: 20Gi storageClassName: ibmc-file-bronze-delayed - metadata: name: myvol2 spec: accessModes: - ReadWriteMany # access mode resources: requests: storage: 20Gi storageClassName: ibmc-file-bronze-delayed