앱에 File Storage for VPC 추가
Red Hat OpenShift on IBM Cloud 클러스터 내 애플리케이션에 대해 ‘ File Storage for VPC ’을 프로비저닝하는 데 사용할 수 있는 사전 정의된 스토리지 클래스를 제공합니다. 각 스토리지 클래스는 프로비저닝하는 파일 공유에 대해 사용 가능한 용량, IOPS, 파일 시스템 및 보존 정책을 지정합니다. 사용 사례에 맞게 직접 스토리지 클래스를 생성할 수도 있습니다.
계속하기 전에 다음 참고 사항과 고려 사항을 검토하세요.
- 스토리지 클래스를 사용하여 특정 유형의 스토리지를 프로비저닝한 후에는 스토리지 디바이스에 대한 유형 또는 보유 정책을 변경할 수 없습니다. 그러나 스토리지 용량 및 성능을 늘리려는 경우에는 크기를 변경 하고 IOPS 를 변경할 수 있습니다. 스토리지의 유형 및 보존 정책을 변경하려면 새 스토리지 인스턴스를 생성하고, 기존 스토리지 인스턴스의 데이터를 새 인스턴스로 복사해야 합니다.
- 클러스터와 VPC가 별도의 리소스 그룹에 있는 경우 파일 공유를 프로비저닝하려면 먼저 자체 스토리지 클래스를 생성하고
resourceGroup섹션 아래에kube-<clusterID>보안 그룹 ID와 함께securityGroupIDs섹션 아래에 VPC 리소스 그룹 ID를 제공해야 합니다. 보안 그룹 ID를 검색하려면 다음과 같이 하세요. 자세한 내용은 나만의 스토리지 클래스 만들기 를 참조하세요. - 클러스터 버전에 새로운 보안 그룹 규칙이 도입되었습니다. 4.11 그리고 나중에. 이러한 규칙 변경은 보안 그룹을 사용하기 전에 먼저 보안 그룹을 동기화해야 함을 의미합니다.File Storage for VPC. 자세한 내용은 다음을 참조하세요.첨가File Storage for VPC 앱에.
- 새로운 스토리지 클래스가 버전에 추가되었습니다.2.0 추가 기능의. 더 이상 이전 스토리지 클래스를 사용하는 새 파일 공유를 프로비저닝할 수 없습니다. 이전 스토리지 클래스를 사용하는 기존 볼륨은 계속 작동하지만 이전 클래스를 사용하여 생성된 볼륨은 확장할 수 없습니다. 자세한 내용은 다음을 참조하세요.새 스토리지 클래스로 마이그레이션.
- 를 사용하여 PVC 만들기 StorageClassSecrets 는 지원되지 않습니다.
- 클러스터를 만드는 사용자에게 VPC 인프라 서비스에 대한 리더, 작성자 및 운영자 권한이 있는지 확인합니다.
- 파일 공유에 암호화를 사용하려는 경우 VPC 인프라스트럭처에서 KMS/HPCS로 서비스 권한을 설정해야 합니다.
IBM Cloud는 전용 키 관리 서비스를 Hyper Protect Crypto Services에서 Key Protect Dedicated로 변경하고 있습니다.
- 기본적으로 File Storage for VPC 클러스터 추가 기능은
kube-<clusterID>보안 그룹에서 파일 공유를 프로비저닝합니다. 이는 팟 (Pod) 이 노드 및 구역에서 파일 공유에 액세스할 수 있음을 의미합니다. - 컨텍스트 기반 제한을 사용하는 경우 네트워크 영역 및 규칙을 구성해야 합니다. 자세한 내용은 컨텍스트 기반 제한으로 가상 프라이빗 클라우드(VPC)인프라 서비스 보호하기를 참조하세요.
4.11 및 이후 버전에서 새로운 보안 그룹 규칙이 도입되었습니다. 이러한 규칙 변경으로 인해 File Storage for VPC 을 사용하기 전에 보안 그룹을 동기화해야 합니다. 클러스터가 처음 생성된 버전이 4.11 이하인 경우, 보안 그룹 설정을 동기화하려면 다음 명령어를 실행하십시오.
- 클러스터의 ID를 확인하세요.
ibmcloud oc cluster ls kube-<clusterID>보안 그룹의 ID를 가져오십시오.ibmcloud is sg kube-CLUSTER_ID | grep ID- 이전 단계에서 검색한 ID를 사용하여
kube-<clusterID>보안 그룹을 동기화합니다.ibmcloud ks security-group sync -c CLUSTER_ID --security-group ID
빠른 시작 가이드 File Storage for VPC
클러스터에 대한 지속적 볼륨 클레임(PVC)을 생성하여 클러스터 간 지속성( File Storage for VPC )을 동적으로 프로비저닝하십시오. 동적 프로비저닝은 해당 영구 볼륨(PV)을 자동으로 생성하고, 계정 내 파일 공유를 주문합니다.
이제 2세대 스토리지 클래스를 선택할 수 있습니다.
-
다음 명령을 실행하여 사전 설치된 스토리지 클래스를 검토하십시오. 자세한 정보는 스토리지 클래스 참조를 참조하십시오.
oc get sc | grep vpc-file -
다음 YAML을 파일에 저장하십시오. 이 예에서는 GB 크기가
10Gi인ibmc-vpc-file-min-iops스토리지 클래스를 사용하여my-pvc라는 청구를 작성합니다.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc # Enter a name for your PVC. spec: accessModes: - ReadWriteMany # The file share can be mounted on multiple nodes and pods. resources: requests: storage: 20Gi # Enter the size of the storage in gigabytes (Gi). storageClassName: ibmc-vpc-file-min-iops # Enter the name of the storage class that you want to use. -
PVC를 작성하십시오.
oc apply -f my-pvc.yaml -
PVC가 작성되고 PV에 바인딩되는지 확인하십시오.
oc describe pvc my-pvc출력 예
Name: my-pvc Namespace: default StorageClass: "" Status: Bound Volume: pvc-0d787071-3a67-11e7-aafc-eef80dd2dea2 Labels: <none> Capacity: 20Gi Access Modes: RWX Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ------ ------- 1m 1m 1 {ibm.io/ibmc-vpc-file 31898035-3011-11e7-a6a4-7a08779efd33 } Normal ProvisioningSucceeded Successfully provisioned volume pvc-0d787071-3a67-11e7-aafc-eef80dd2dea2 -
다음 배치 구성을
deployment.yaml파일에 저장하고 이전 단계에서 작성한 PVC를 참조하십시오.apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment labels: app: my-deployment spec: selector: matchLabels: app: busybox template: metadata: labels: app: busybox spec: containers: - name: busybox image: busybox:1.28 command: [ "sh", "-c", "sleep 1h" ] volumeMounts: - name: my-vol mountPath: /data/demo # Mount path for the application. volumes: - name: my-vol persistentVolumeClaim: claimName: my-pvc # Your PVC name.volumeMounts.mountPath- container volumeMounts 섹션에서, 컨테이너 내에서 볼륨이 마운트되는 디렉토리의 절대 경로를 입력하십시오. 마운트 경로에 기록된 데이터는 물리적 File Storage for VPC 인스턴스의
root디렉터리 아래에 저장됩니다. 서로 다른 앱 간에 볼륨을 공유하려면, 각 앱에 대해 볼륨 하위 경로를 지정할 수 있습니다. volumeMounts.name- container volumeMounts 섹션에서, 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오.
volume.name- volumes 섹션에서, 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오. 일반적으로 이 이름은
volumeMounts.name과 동일합니다. claimName- 볼륨의 지속적 볼륨 청구 섹션에 사용할 PV를 바인드하는 PVC의 이름을 입력하십시오.
-
배치를 작성하십시오.
oc apply -f deployment.yaml -
PV가 성공적으로 마운트되었는지 확인하십시오.
oc describe deployment my-deployment마운트 지점은 Volume Mounts 필드에 있고 볼륨은 Volumes 필드에 있습니다.
Containers: Mounts: /data/demo from my-vol (rw) Volumes: my-vol: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: my-pvc ReadOnly: false -
선택사항: 팟 (Pod) 이 실행된 후 스토리지 볼륨 확장 을 시도하십시오.
새 스토리지 클래스로 마이그레이션
- 새로운 스토리지 클래스가 버전에 추가되었습니다.2.0 추가 기능의.
- 더 이상 이전 스토리지 클래스를 사용하는 새 파일 공유를 프로비저닝할 수 없습니다.
- 이전 스토리지 클래스를 사용하는 기존 볼륨은 계속 작동하지만 이전 클래스를 사용하여 생성된 볼륨은 확장할 수 없습니다.
- 볼륨 확장 기능이 필요한 경우 다음 단계를 완료하여 앱을 최신 스토리지 클래스로 마이그레이션하세요.
- 볼륨 확장 기능이 필요하지 않은 경우 마이그레이션할 필요가 없으며 PVC는 계속 정상적으로 작동합니다.
- 다음 단계에서는 수동 마이그레이션을 다룹니다.
-
마이그레이션하려는 PVC를 찾고 PVC 이름과 연관된 PV 이름을 모두 기록해 두십시오.
oc get pvc -
PVC를 사용하는 앱을 축소합니다.
oc scale deployment DEPLOYMENT --replicas 0 -
회수 정책을 다음으로 변경하기 위해 앱이 사용하는 PV 객체를 편집하세요.
Retain및 스토리지 클래스ibmc-vpc-file-min-iops.kubectl edit pv PVspec: accessModes: - ReadWriteMany capacity: storage: 20Gi claimRef: apiVersion: v1 kind: PersistentVolumeClaim name: <pvc-name> namespace: default ... persistentVolumeReclaimPolicy: Retain # Change delete to retain storageClassName: ibmc-vpc-file-min-iops # Enter a new storage class volumeMode: Filesystem -
기존 PVC 객체를 삭제합니다.
kubectl delete pvc PVC -
PV를 다시 편집하고
claimRef부분.kubectl edit pv PVspec: accessModes: - ReadWriteMany capacity: storage: 20Gi #claimRef: #apiVersion: v1 #kind: PersistentVolumeClaim #name: <pvc-name> #namespace: default #resourceVersion: "381270" #uid: 4042f319-1233-4187-8549-8249a840a8dd -
이전 PVC와 이름과 크기가 동일한 PVC를 만듭니다. 이 작업은 영향을 받는 모든 PVC에 대해 하나씩 수행해야 합니다.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: <pvc-name> spec: accessModes: - ReadWriteMany resources: requests: storage: <size>Gi storageClassName: ibmc-vpc-file-min-iops -
PVC를 사용하고 있던 앱을 확장하세요.
k scale deployment DEPLOYMENT --replicas x -
볼륨 확장을 계속 사용하려면 다음을 참조하세요.볼륨 확장 설정.
볼륨 확장 설정
확장을 지원하는 볼륨을 프로비저닝하려면 allowVolumeExpansion이 true로 설정된 스토리지 클래스를 사용해야 합니다.
File Storage for VPC 클러스터 애드온은 온라인 및 오프라인 모드 모두에서 확장을 지원합니다. 그러나 확장은 File Storage for VPC 프로필의 지정된 크기 및 IOPs 범위 내에서만 가능합니다.
2.0 버전에서 새로운 저장 클래스가 도입되었습니다. 이전 버전의 추가 기능의 스토리지 클래스를 사용하는 공유에서는 볼륨 확장이 작동하지 않습니다.
시작하기 전에
-
볼륨 확장을 사용하려면 애드온을 최소 버전으로 업데이트하세요 2.0.
-
앱이 최신 스토리지 클래스 중 하나를 사용하고 있는지 확인하세요. 마이그레이션 단계는 다음을 참조하세요.새 스토리지 클래스로 마이그레이션
-
실행 중인 앱이 없으면 먼저 다음을 배포하세요.빠른 시작 예제 PVC 및 배포.
마운트된 볼륨 확장
-
PVC가 앱 팟(Pod)에서 마운트된 후 PVC의
spec.resources.requests.storage필드 값을 편집하여 볼륨을 확장할 수 있습니다. 볼륨을 확장하려면 PVC를 편집하여spec.resources.requests.storage필드의 값을 늘리십시오.kubectl edit pvc my-pvcspec: accessModes: - ReadWriteMany resources: requests: storage: 50Gi -
PVC를 저장한 후 닫으십시오. 볼륨이 확장될 때까지 몇 분 정도 기다리십시오.
-
볼륨이 확장되었는지 확인하십시오.
kubectl get pvc출력 예
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE my-pvc Bound pvc-25b6912e-75bf-41ca-b6b2-567fa4f9d245 50Gi RWX ibmc-vpc-file-min-iops 3m31s
앱에 기존 파일 스토리지 첨부
클러스터에 대한 지속적 볼륨 클레임(PVC)을 생성하여 지속적 볼륨( File Storage for VPC )을 정적으로 프로비저닝하십시오. 정적 프로비저닝을 사용하면 클러스터 관리자가 기존 스토리지 디바이스를 클러스터에 사용할 수 있도록 설정할 수 있습니다.
-
클러스터 ID를 가져오십시오.
ibmcloud ks cluster ls -
kube-<clusterID>보안 그룹의 ID를 가져옵니다.ibmcloud is sg kube-CLUSTER_ID | grep ID -
파일 공유를 작성하십시오. 자세한 정보는 파일 공유 및 마운트 대상 작성 을 참조하십시오.
ibmcloud is share-create --name my-file-share --zone us-south-2 --profile dp2 --size 1000 --iops 1000 -
공유 마운트 대상을 만들고 앞서
kube-<clusterID>옵션에서 검색한 보안 그룹 ID를--vni-sgs로 지정합니다.ibmcloud is share-mount-target-create my-file-share --subnet my-subnet --name NAME --vni-name my-share-vni-1 --vni-sgs kube-CLUSTER_ID --resource-group-name Default --vpc ID -
지속적 볼륨 (PV) 을 작성하기 전에 파일 공유에 대한 세부사항을 검색하십시오.
ibmcloud is shares -
귀하의 지분에 대한 세부 정보를 확인하세요. 마운트 대상을 기록해 두십시오.
ibmcloud is share SHARE-ID예제 명령입니다.
ibmcloud is share r134-bad98878-1f63-45d2-a3fd-60447094c2e6출력 예
ID r134-bad98878-1f63-45d2-a3fd-60447094c2e6 Name pvc-e7e005a9-e96b-41ad-9d6e-74650a9110a0 CRN crn:v1:staging:public:is:us-south-1:a/77f2bceddaeb577dcaddb4073fe82c1c::share:r134-bad98878-1f63-45d2-a3fd-60447094c2e6 Lifecycle state stable Access control mode security_group Zone us-south-1 Profile dp2 Size(GB) 10 IOPS 100 User Tags clusterid:cpjao3l20dl78jadqkd0,namespace:default,provisioner:vpc.file.csi.ibm.io,pv:pvc-e7e005a9-e96b-41ad-9d6e-74650a9110a0,pvc:pv-file,reclaimpolicy:delete,storageclass:custom-eni Encryption provider_managed Mount Targets ID Name r134-aa2aabb8-f616-47be-886b-99220852b728 pvc-e7e005a9-e96b-41ad-9d6e-74650a9110a0 Resource group ID Name 300b9469ee8676f9a038ecdf408c1a9d Default Created 2024-06-11T19:55:11+05:30 Replication role none Replication status none Replication status reasons Status code Status message -
Mount Path라고도 하는nfsServerPath를 가져오십시오.ibmcloud is share-mount-target SHARE-ID SHARE-TARGET-ID예제 명령입니다.
ibmcloud is share-mount-target r134-bad98878-1f63-45d2-a3fd-60447094c2e6 r134-aa2aabb8-f616-47be-886b-99220852b728출력 예
ID r134-aa2aabb8-f616-47be-886b-99220852b728 Name pvc-e7e005a9-e96b-41ad-9d6e-74650a9110a0 VPC ID Name r134-f05922d4-d8ab-4f64-9a3d-82664b303bc1 vpc-public Access control mode security_group Resource type share_mount_target Virtual network interface ID Name 0716-6407fb4b-e962-49c4-8556-dc94f4574b4b defective-chloride-huffy-gladly Lifecycle state stable Mount path 10.240.0.23:/89d8a454_f552_42bf_8374_4d31481edf4d Transit Encryption none Created 2024-06-11T19:55:12+05:30 -
파일 공유를 참조하는
static-file-share.yaml라는 PV 구성 파일을 작성하십시오.apiVersion: v1 kind: PersistentVolume metadata: name: static-file-share spec: mountOptions: - hard - nfsvers=4.1 - sec=sys accessModes: - ReadWriteMany capacity: storage: 10Gi csi: volumeAttributes: nfsServerPath: NFS-SERVER-PATH driver: vpc.file.csi.ibm.io volumeHandle: FILE-SHARE-ID#SHARE-TARGET-ID -
PV를 작성하십시오.
oc apply -f static-file-share.yaml -
PVC를 작성하십시오.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-static spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: "" #Leave the storage class blank. -
PVC를 작성하여 PV를 바인드하십시오.
oc apply -f pvc-static.yaml -
배포 파일 이름
testpod.yaml을 생성하여 파일공유를 애플리케이션 포드에 첨부합니다.apiVersion: apps/v1 kind: Deployment metadata: name: testpod labels: app: testpod spec: selector: matchLabels: app: busybox template: metadata: labels: app: busybox spec: containers: - name: busybox image: busybox:1.28 command: [ "sh", "-c", "sleep 1h" ] volumeMounts: - name: my-vol mountPath: /data/demo # Mount path for the application. volumes: - name: pvc-name persistentVolumeClaim: claimName: pvc-static # The name of the PVC that you created earlierspec.containers.volumeMounts.mountPath- 컨테이너 내에서 볼륨이 마운트되는 디렉토리의 절대 경로를 입력하십시오. 마운트 경로에 기록된 데이터는 물리적 File Storage for VPC 인스턴스의
root디렉터리 아래에 저장됩니다. 서로 다른 앱 간에 볼륨을 공유하려면, 각 앱에 대해 볼륨 하위 경로를 지정할 수 있습니다. volumeMounts.name- 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오.
volume.name- 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오. 일반적으로 이 이름은
volumeMounts.name과 동일합니다. volumes.persistentVolumeClaim.claimName- 사용하려는 PV를 바인딩하는 PVC의 이름을 입력하세요.
-
배치를 작성하십시오.
oc apply -f testpod.yaml
사용자 고유의 스토리지 클래스 작성
File Storage for VPC 인스턴스에 적합한 설정을 적용하여 사용자 정의 스토리지 클래스를 생성할 수 있습니다. 비용을 낮게 유지하려면 처음에는 최소 처리량으로 PVC를 프로비저닝한 다음 나중에 필요에 따라 PVC에 액세스하여 처리량을 조정할 수 있습니다.
다음 기능이 필요한 경우 사용자 고유의 스토리지 클래스를 작성 해야 합니다.
- 앱을 루트가 아닌 사용자로 실행해야 합니다.
- 클러스터가 VPC및 서브넷과 다른 리소스 그룹에 있습니다.
- 지정된 노드 또는 지정된 구역의 팟 (Pod) 에 대한 파일 공유 액세스를 제한해야 합니다.
- HPCS 또는 Key Protect와 같은 KMS 제공자를 사용하여 사용자 고유의 (BYOK) 암호화를 가져와야 합니다.
- 가상 네트워크 인터페이스(VNI) 의 서브넷 또는 IP 주소를 수동으로 지정해야 합니다.
- 용량과 대역폭에 대한 더 많은 제어가 필요합니다. 이 경우
rfs프로필을 사용할 수 있습니다. 자세한 내용은 지역별 파일 공유 개요를 참조하세요. - 요청된 PVC 용량을 고정 IOPS
dp2프로파일에서 지원하는 최소 용량으로 자동으로 올림 처리하고자 합니다. 자세한 내용은 ‘고정 IOPS 프로필에 대한 자동 용량 반올림 활성화’를 참조하십시오.
클러스터와 VPC가 동일한 리소스 그룹에 속하지 않는 경우 resourceGroup 섹션에 VPC 리소스 그룹 ID를 지정하고 kube-<clusterID> 섹션에 securityGroupIDs 보안 그룹 ID를 지정해야 합니다. kube-<clusterID> 보안 그룹의 ID는 ibmcloud is sg kube-CLUSTER_ID | grep ID 를 실행하여 찾을 수 있습니다.
-
저장 클래스 구성 파일을 생성합니다. 다음 예제에서는
dp2프로필을 사용합니다. 1세대와 2세대 스토리지 클래스 중에서 선택하세요.1세대 예시:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ibmc-vpc-file-custom-sc labels: app.kubernetes.io/name: ibm-vpc-file-csi-driver provisioner: vpc.file.csi.ibm.io mountOptions: - hard - nfsvers=4.1 - sec=sys parameters: profile: "dp2" # or rfs billingType: "hourly" # hourly or monthly encrypted: "false" encryptionKey: "" # If encrypted is true, then a user must specify the CRK-CRN. resourceGroup: "" # Resource group ID. By default, the resource group of the cluster will be used from storage-secrete-store secret. isENIEnabled: "true" # VPC File Share VNI feature will be used by all PVCs created with this storage class. securityGroupIDs: "" # By default cluster security group i.e kube-<clusterID> will be used. User can provide their own comma separated SGs. subnetID: "" # User can provide subnetID in which the VNI will be created. Zone and region are mandatory for this. If not provided CSI driver will use the subnetID available in the cluster's VPC zone. region: "" # VPC CSI driver will select a region from cluster node's topology. The user can override this default. zone: "" # VPC CSI driver will select a region from cluster node's topology. The user can override this default. primaryIPID: "" # Existing ID of reserved IP from the same subnet as the file share zone. Zone and region are mandatory for this. SubnetID is not mandatory for this. primaryIPAddress: "" # IPAddress for VNI to be created in the subnet of the zone. Zone, region and subnetID are mandatory for this. iops: "" # Example: 100, this option is valid only for the dp2 profile. allowCapacityRoundoffForIops: "true" # Optional. Enables automatic capacity roundoff for fixed IOPS dp2 profiles. When set to "true", if the requested PVC size is lower than the minimum supported capacity for the requested IOPS, the driver automatically provisions the volume at the minimum supported capacity. Disabled by default. Requires a Virtual Private Endpoint Gateway (VPEG) to IBM Global Catalog. throughput: "" # Example: 2000, this option is valid only for the rfs profile tags: "" # User can add a list of tags "a, b, c" that will be used at the time of provisioning file share, by default CSI driver has its own tags. uid: "0" # The initial user identifier for the file share, by default its root. gid: "0" # The initial group identifier for the file share, by default its root. classVersion: "1" reclaimPolicy: "Delete" allowVolumeExpansion: true2세대 예시:
1세대
ibmc-vpc-file-min-iops스토리지 클래스를 사용하여 10Gi PVC를 프로비저닝하는 경우 최대 IOPS는 1,000입니다. 기본 할당량은 100이며 처리량은 210Mbps로 고정되어 있으며 조정할 수 없습니다.그러나 2세대
ibmc-vpc-file-regional스토리지 클래스를 사용하여 10Gi PVC를 프로비저닝하는 경우 IOPS는 35,000으로 고정되고 최대 처리량은 기본값이 8Mbps이지만 8192Mbps까지 조정할 수 있습니다.다른 예를 들어, 처음에 1세대
ibmc-vpc-file-500-iops스토리지 클래스를 사용하여 16TB 미만의 크기와 고정 IOPS 500의 PVC를 프로비저닝하는 경우, IOPS와 처리량은 크기와 IOPS를 기준으로 고정되어 계산됩니다.해당 PVC를 16TB 이상으로 확장하려면 1세대
ibmc-vpc-file-500-iops스토리지 클래스가 작동하지 않습니다. 대신 2세대ibmc-vpc-file-regional-max-bandwidth스토리지 클래스를 사용하면 모든 크기의 PVC를 최대 32TB까지 프로비저닝할 수 있으며, 최대 35000 IOPS와 기본 처리량 8192Mbps(조정 가능)를 제공합니다.apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ibmc-vpc-file-regional-max-bandwidth labels: app.kubernetes.io/name: ibm-vpc-file-csi-driver annotations: version: v2.0 revision: "1" provisioner: vpc.file.csi.ibm.io mountOptions: - hard - nfsvers=4.1 - sec=sys parameters: profile: "rfs" # general-purpose, sdp, 5iops-tier, 10iops-tier, or custom billingType: "hourly" encrypted: "false" encryptionKey: "" resourceGroup: "" throughput: "8192" # Example: 2000 classVersion: "1" isENIEnabled: "true" # VPC File Share ENI/VNI feature will be used by all PVCs created with this storage class. securityGroupIDs: "" # By default cluster security group i.e kube-<clusterID> will be used. User can provide their own command separated SGs. subnetID: "" # User can provide subnetID in which the ENI/VNI will be created.If not provided CSI driver will use the subnetID available in the cluster' VPC zone. primaryIPID: "" # Existing ID of reserved IP from any of subnets within the VPC,subnetID is not mandatory for this. primaryIPAddress: "" # IPAddress for ENI/VNI to be created in the respective subnet,subnetID is mandatory for this. uid: "0" # The initial user identifier for the file share, by default its root. gid: "0" # The initial group identifier for the file share, by default its root. allowVolumeExpansion: true # Select true or false. Only supported on version 3.0.1 and later reclaimPolicy: "Delete" -
클러스터에 사용자 정의된 스토리지 클래스를 작성하십시오.
oc apply -f custom-storageclass.yaml -
클러스터에서 스토리지 클래스가 사용 가능한지 확인하십시오.
oc get sc출력 예
ibmc-vpc-file-custom-sc vpc.file.csi.ibm.io
기본 스토리지 클래스 설정
- 기본 스토리지 클래스 변경은 애드온 버전 2.0 이상에서만 가능합니다.
- 기본 스토리지 클래스를 사전 설치된 File Storage for VPC 클래스 중 하나 또는 사용자 지정 스토리지 클래스로 설정할 수 있습니다. 사용자 지정 스토리지 클래스를 사용하는 경우 프로비저너가
vpc.file.csi.ibm.io로 설정되어 있는지 확인하세요. - 클러스터에서 여러 스토리지 클래스가 기본값으로 설정되어 있는 경우, 기본 스토리지 클래스 중 하나를 사용할 수 있습니다. 올바른 스토리지 클래스가 사용되도록 하려면 새 기본 클래스를 설정하기 전에 클러스터의 기존 기본 스토리지 클래스를 모두 제거하는 것이 가장 좋습니다. VPC 블록 스토리지 애드온도 설치되어 있는 경우, VPC 블록 스토리지 클래스가 이미 기본값으로 설정되어 있을 수 있습니다. 새 기본값을 설정하기 전에 이를 제거하려면 ‘VPC 블록 스토리지의 기본 스토리지 클래스 변경’을 참조하십시오.
-
addon-vpc-file-csi-driver-configmap구성 맵을 편집하고SET_DEFAULT_STORAGE_CLASS매개 변수에 스토리지 클래스 이름을 지정합니다.oc edit cm addon-vpc-file-csi-driver-configmap -n kube-system출력 예
SET_DEFAULT_STORAGE_CLASS: "ibmc-vpc-file-eit" -
file-csi-driver-status구성 맵을 설명하여 기본값이 올바르게 설정되었는지 확인합니다.oc describe cm file-csi-driver-status -n kube-system출력 예.
events: ---- - event: EnableVPCFileCSIDriver description: 'VPC File CSI Driver enable successful, DriverVersion: v2.0.6' timestamp: "2024-09-20 12:01:02" - event: Change default storage class request description: Successfully set 'ibmc-vpc-file-eit' as default storage class timestamp: "2024-09-20 12:01:36"
루트가 아닌 사용자로 실행되는 앱 배치
스토리지 클래스의 uid 및 gid 매개변수는 인프라 수준에서 파일 공유의 초기 사용자 및 그룹 식별자를 설정합니다. VPC 파일 스토리지에서 보충 ID가 어떻게 작동하는지에 대한 배경 정보는 ‘VPC 파일 공유용 보충 ID’를 참조하십시오.
-
자체 스토리지 클래스를 작성하고 앱에 사용할 그룹 ID 또는 사용자 ID를 지정하십시오.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ibmc-vpc-file-custom-sc labels: app.kubernetes.io/name: ibm-vpc-file-csi-driver provisioner: vpc.file.csi.ibm.io mountOptions: - hard - nfsvers=4.1 - sec=sys parameters: profile: "dp2" iops: "100" billingType: "hourly" # hourly or monthly encrypted: "false" uid: "3000" # The initial user identifier for the file share. gid: "1000" # The initial group identifier for the file share. classVersion: "1" reclaimPolicy: "Delete" allowVolumeExpansion: true -
다음 YAML을
my-pvc.yaml라는 파일에 저장하십시오.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: ibmc-vpc-file-custom-sc -
PVC를 작성하십시오.
oc apply -f my-pvc.yaml -
PVC를 마운트하는 팟 (Pod) 을 작성하십시오.
apiVersion: v1 kind: Pod metadata: name: security-context-demo spec: securityContext: runAsUser: 3000 runAsGroup: 1000 volumes: - name: sec-ctx-vol persistentVolumeClaim: claimName: my-pvc containers: - name: sec-ctx-demo image: busybox:1.28 command: [ "sh", "-c", "sleep 1h" ] volumeMounts: - name: sec-ctx-vol mountPath: /data/demo securityContext: allowPrivilegeEscalation: false -
포드가 실행 중인지 확인하십시오.
oc get pods
File Storage for VPC 대한 KMS 암호화 설정
IBM® Key Protect 또는 Hyper Protect Crypto Services 과 같은 키 관리 서비스(KMS) 제공업체를 사용하여, File Storage for VPC 인스턴스에서 데이터가 스토리지에 기록될 때 데이터를 암호화하는 데 사용할 개인 루트 키를 생성하십시오. 개인 루트 키를 생성한 후, 해당 루트 키를 사용하여 자체 스토리지 클래스를 생성하거나 ‘ Kubernetes ’ 시크릿을 생성한 다음, 이 스토리지 클래스나 시크릿을 사용하여 File Storage for VPC 인스턴스를 프로비저닝하십시오.
-
사용하려는 KMS 공급자의 인스턴스를 생성합니다.
-
KMS 인스턴스에서 루트 키를 생성하십시오.
- Key Protect 루트 키.
- Hyper Protect Crypto Services 루트 키. 기본적으로 루트 키는 만료 날짜 없이 작성됩니다.
-
고객 관리 암호화를 위한 전제 조건을 완료하고 File Storage for VPC 에 액세스하도록 승인합니다( IBM® Key Protect ). File Storage for VPC에 최소
Reader이상의 KMS 인스턴스 액세스 권한을 부여해야 합니다. -
사용자 지정 스토리지 클래스를 만들고 KMS 세부 정보를 지정합니다.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: custom-sc-encrypted labels: app.kubernetes.io/name: ibm-vpc-file-csi-driver provisioner: vpc.file.csi.ibm.io mountOptions: - hard - nfsvers=4.1 - sec=sys parameters: profile: "dp2" billingType: "hourly" # hourly or monthly encrypted: "true" encryptionKey: "" # Specify the root key CRN. resourceGroup: "" # Resource group ID. By default, the resource group of the cluster will be used from storage-secrete-store secret. isENIEnabled: "true" # VPC File Share VNI feature will be used by all PVCs created with this storage class. securityGroupIDs: "" # By default cluster security group i.e kube-<clusterID> will be used. User can provide their own comma separated SGs. subnetID: "" # User can provide subnetID in which the VNI will be created. Zone and region are mandatory for this. If not provided CSI driver will use the subnetID available in the cluster's VPC zone. region: "" # VPC CSI driver will select a region from cluster node's topology. The user can override this default. zone: "" # VPC CSI driver will select a region from cluster node's topology. The user can override this default. primaryIPID: "" # Existing ID of reserved IP from the same subnet as the file share zone. Zone and region are mandatory for this. SubnetID is not mandatory for this. primaryIPAddress: "" # IPAddress for VNI to be created in the subnet of the zone. Zone, region and subnetID are mandatory for this. tags: "" # User can add a list of tags "a, b, c" that will be used at the time of provisioning file share, by default CSI driver has its own tags. uid: "0" # The initial user identifier for the file share, by default its root. gid: "0" # The initial group identifier for the file share, by default its root. classVersion: "1" reclaimPolicy: "Delete" allowVolumeExpansion: true -
스토리지 클래스를 작성하십시오.
oc apply -f encrypted-class.yaml -
다음 YAML을
my-pvc.yaml라는 파일에 저장하십시오.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: custom-sc-encrypted -
PVC를 작성하십시오.
oc apply -f my-pvc.yaml -
다음 배치 구성을
deployment.yaml파일에 저장하고 이전 단계에서 작성한 PVC를 참조하십시오.apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment labels: app: my-deployment spec: selector: matchLabels: app: busybox template: metadata: labels: app: busybox spec: containers: - name: busybox image: busybox:1.28 command: [ "sh", "-c", "sleep 1h" ] volumeMounts: - name: my-vol mountPath: /data/demo # Mount path for the application. volumes: - name: my-vol persistentVolumeClaim: claimName: my-pvc # Your PVC name.volumeMounts.mountPath- container volumeMounts 섹션에서, 컨테이너 내에서 볼륨이 마운트되는 디렉토리의 절대 경로를 입력하십시오. 마운트 경로에 기록된 데이터는 물리적 File Storage for VPC 인스턴스의
root디렉터리 아래에 저장됩니다. 서로 다른 앱 간에 볼륨을 공유하려면, 각 앱에 대해 볼륨 하위 경로를 지정할 수 있습니다. volumeMounts.name- container volumeMounts 섹션에서, 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오.
volume.name- volumes 섹션에서, 팟(Pod)에 마운트할 볼륨의 이름을 입력하십시오. 일반적으로 이 이름은
volumeMounts.name과 동일합니다.
-
배치를 작성하십시오.
oc apply -f deployment.yaml
전송 중 암호화(EIT) 설정
File Storage for VPC 에 대한 전송 중 암호화를 설정하려면, IBM Cloud File Storage for VPC 의 ‘전송 중 암호화’를 참조하십시오. 이 주제는 구역별 파일 공유(dp2 프로필)와 지역별 파일 공유(rfs 프로필, 베타)를 모두
다룹니다.
컨테이너 리소스 요청량 및 제한값 업데이트
File Storage for VPC 애드온에서 실행되는 컨테이너에 대한 CPU 및 메모리 리소스 요청량과 제한을 사용자 지정할 수 있습니다. 이러한 값을 조정하면 대규모 클러스터나 리소스가 제한된 환경에서 성능을 최적화하는 데 도움이 될 수 있습니다.
매개변수의 명명 규칙은 다음과 같습니다. <ContainerName>CPULimit, <ContainerName>CPURequest, <ContainerName>MemoryLimit, <ContainerName>MemoryRequest. 이를 컨트롤러 및 노드 서버 컨테이너에 적용하십시오.
-
addon-vpc-file-csi-driver-configmap구성 맵을 편집하고, 조정하려는 컨테이너에 대한 리소스 매개변수를 추가하십시오. 다음 예제는 컨트롤러 및 노드 서버 컨테이너에 대한 CPU 및 메모리 값을 설정합니다.oc edit cm addon-vpc-file-csi-driver-configmap -n kube-system예제 값:
controllerCPULimit: "200m" controllerCPURequest: "100m" controllerMemoryLimit: "256Mi" controllerMemoryRequest: "128Mi" nodeServerCPULimit: "200m" nodeServerCPURequest: "100m" nodeServerMemoryLimit: "256Mi" nodeServerMemoryRequest: "128Mi" -
file-csi-driver-status구성 맵을 참조하여 리소스 변경 사항이 성공적으로 적용되었는지 확인하십시오. ‘events’ 섹션에서 ‘Successfully set container resources’ 행사를 찾아보세요.oc describe cm file-csi-driver-status -n kube-system출력 예:
events: ---- - description: Successfully set container resources event: Change container resources timestamp: "2026-06-26 08:32:05"
작업자 풀, 구역 또는 작업자 노드별로 파일 공유 액세스 제한
File Storage for VPC 클러스터 추가 기능의 기본 동작은 모든 노드의 팟 (Pod) 이 파일 공유에 액세스할 수 있는 것입니다. 팟 (Pod) 이 파일 공유에 액세스하는 방법에 대해 보다 세부적인 제어를 적용할 수도 있습니다. 예를 들어, 특정 노드, 특정 구역, 특정 작업자 풀의 팟 (Pod) 에 대한 파일 공유 액세스를 제한할 수 있습니다. 파일 공유에 대한 팟 (Pod) 액세스를 구성하는 방법에 대해서는 다음 시나리오를 검토하십시오.
PVC가 생성되면 PVC당 하나의 파일 공유 대상이 생성되고 해당 영역의 서브넷에 하나의 VNI IP가 예약됩니다. 즉, VPC 파일 스토리지에 대한 최대 PVC수는 해당 서브넷에서 사용 가능한 IP 주소에 따라 다릅니다.
다음 VNI 기능을 사용하여 파일 공유에 대한 팟 (Pod) 액세스를 제한하는 경우 앱의 가용성이 높지 않을 수 있습니다.
시작하기 전에
노드, 구역 또는 리소스 그룹별로 파일 공유 액세스를 제한하려면 먼저 사용자 정의 VPC 보안 그룹을 작성해야 합니다.
-
클러스터를 나열하고 파일 스토리지를 배치할 클러스터 ID를 기록해 두십시오.
ibmcloud ks cluster ls -
작업자 풀 세부 정보를 가져옵니다.
ibmcloud ks worker-pool ls --cluster CLUSTER -
서브넷 세부 정보를 확인하세요.
ibmcloud ks worker-pool get WORKER_POOL --cluster CLUSTER | grep -A 3 Subnets -
서브넷 CIDR을 가져옵니다. 각 서브넷에 대해 이 단계를 반복하십시오. 이 CIDR 범위는 나중에 사용합니다.
ibmcloud is subnet SUBNET_ID | grep "IPv4 CIDR" -
보안 그룹을 나열하고 클러스터의 ID
kube-<clusterID>보안 그룹을 기록해 두십시오. 나중에 보안 그룹 규칙을 추가할 때 보안 그룹 ID가 필요합니다.ibmcloud is sg출력 예
ID Name Rules Targets VPC Resource group r006-4aaec88f-4986-4b7c-a737-401f7fef1555 kube-clusterID 15 0 my-vpc default -
클러스터와 동일한 VPC에서 사용자 정의 보안 그룹을 작성하십시오. 이 보안 그룹을 사용하여 보안 그룹 규칙을 추가하여 파일 공유에 대한 액세스를 제어할 수 있습니다.
ibmcloud is security-group-create my-custom-security-group VPC-ID -
사용자 고유의 스토리지 클래스를 작성 하고 이전에 작성한 사용자 정의 보안 그룹의 ID를 입력하십시오. 이 스토리지 클래스에서 작성된 모든 PVC는 사용자 정의 보안 그룹에 있습니다.
-
사용자 정의 스토리지 클래스를 사용하는 PVC를 생성합니다.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-custom-vni spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: "" # For example: my-custom-storage-class -
PV가 PVC에 바인드된 후, PV 세부사항을 가져오고
nfsServerPath값을 기록하여 VNI IP 주소를 찾으십시오.kubectl get pv pvc-XXXX -o yaml | grep nfsServerPath출력 예
nfsServerPath: XXX.XX.XX.XXX:/XX # VNI IP address
하나의 작업자 노드에서 팟 (Pod) 에 대한 파일 공유 액세스 제한
-
필수 요건을 완료했는지 확인하세요.
-
이전에 작성한 사용자 정의 보안 그룹에 다음 규칙을 추가하십시오.
ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.20 # Worker node IP -
kube-clusterID보안 그룹에 다음 규칙을 추가하십시오.ibmcloud is sg-rulec kube-<cluster-id> outbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.10 # VNI IP -
PVC를 사용하는 배치를 작성하십시오. 작성한 규칙과 일치하는 작업자 노드에 배치된 팟 (Pod) 만 PVC를 마운트하거나 사용할 수 있습니다. 다른 노드에 배치된 팟 (Pod) 은 컨테이너
creating상태에 머물러 있습니다.
단일 구역에서 작업자 노드의 팟 (Pod) 에 대한 파일 공유 액세스 제한
-
필수 요건을 완료했는지 확인하세요.
-
이전에 작성한 사용자 정의 보안 그룹에 다음 규칙을 추가하십시오.
ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.0/24 # zone subnet cidr range -
kube-clusterID보안 그룹에 다음 규칙을 추가하십시오. 가상 네트워크 인터페이스 (VNI) 의 IP 주소를 지정하십시오.ibmcloud is sg-rulec kube-<cluster-ID> outbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.10 # VNI IP -
PVC를 사용하는 배치를 작성하십시오. 이전 규칙에 나열된 구역에 배치된 팟 (Pod) 만 PVC를 마운트할 수 있습니다. 다른 구역에 배치된 팟 (Pod) 은 PVC에 액세스할 수 없으며 컨테이너
creating상태에 머물러 있습니다.
단일 작업자 풀의 작업자 노드에 있는 팟 (Pod) 에 대한 파일 공유 액세스 제한
-
필수 요건을 완료했는지 확인하세요.
-
각 작업자 풀 서브넷 범위에 대한 인바운드 규칙을 만듭니다.
ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.0/24 # zone 1 subnet cidr range ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.1.0/24 # zone 2 subnet cidr range -
kube-clusterID보안 그룹에 다음 규칙을 추가하십시오. 가상 네트워크 인터페이스 (VNI) 의 IP 주소를 원격 또는 소스로 지정하십시오.ibmcloud is sg-rulec kube-<cluster-ID> outbound tcp --port-min 111 --port-max 2049 --remote 10.240.0.10 # VNI IP -
앞서 생성한 PVC를 사용하는 앱을 배포합니다. 이전 규칙에 표시된 작업자 풀의 팟 (Pod) 만 PVC를 마운트할 수 있습니다. 또는 디먼 세트에서 앱을 배치하는 경우 팟 (Pod) 은 보안 그룹 규칙을 작성한 작업자 노드에만 성공적으로 배치됩니다. 지정된 작업자 풀에 없는 작업자 풀의 팟 (Pod) 이
MountVolume.SetUp failed for volume "pvc-184b8c92-33ea-4874-b2ac-17665e53c060" : rpc error: code = DeadlineExceeded desc = context deadline exceeded오류와 함께 실패합니다.
여러 작업자 풀에 있는 작업자 노드의 팟 (Pod) 에 대한 파일 공유 액세스 제한
-
필수 요건을 완료했는지 확인하세요.
-
사용자 지정 보안 그룹에 다음 규칙을 추가하십시오. 작업자 풀 및 서브넷 CIDR 범위를 원격 또는 소스로 지정하십시오.
ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.1.0/24 # worker pool 1, zone 1 subnet CIDR range ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.240.1.0/24 # worker pool 1, zone 2 subnet CIDR range ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.241.0.0/24 # worker pool 2, zone 1 subnet CIDR range ibmcloud is sg-rulec CUSTOM-SG inbound tcp --port-min 111 --port-max 2049 --remote 10.241.1.0/24 # worker pool 2, zone 2subnet CIDR range -
kube-<clusterID>보안 그룹에 다음 규칙을 추가하십시오. 가상 네트워크 인터페이스 (VNI) 의 IP 주소를 원격 또는 소스로 지정하십시오.ibmcloud is sg-rulec kube-<clusterID> outbound tcp --port-min 111 --port-max 2049 --remote 10.240.1.7 # VNI-IP -
PVC를 사용하는 배치를 작성하십시오. 규칙에 표시된 구역에 배치된 팟 (Pod) 만 PVC를 마운트할 수 있습니다. 제한된 작업자 노드에 배치된 팟 (Pod) 은 컨테이너
creating상태로 고정됩니다.