7.2. PVC에서 영구 스토리지 요청
다음과 같은 경우 PVC(PersistentVolumeClaim)를 적용하여 작업 공간에 PersistentVolume(PV)을 요청할 수 있습니다.
- 모든 프로젝트에 PV가 필요한 것은 아닙니다.
- PV 라이프사이클은 단일 작업 공간의 라이프사이클을 초과합니다.
- PV에 포함된 데이터는 작업 공간 간에 공유됩니다.
작업 공간이 임시이고 devfile에 controller.devfile.io/storage-type: ephemeral 속성이 포함된 경우에도 Dev Workspace 컨테이너에 PVC를 적용할 수 있습니다.
사전 요구 사항
- 작업 공간을 시작하지 않았습니다.
-
대상 OpenShift 클러스터에 대한 관리 권한이 있는 활성
oc세션. CLI 시작하기를 참조하십시오. -
모든
Dev Workspace컨테이너에 마운트할 사용자 프로젝트에 PVC가 생성됩니다.
절차
PVC에
controller.devfile.io/mount-to-devworkspace: true라벨을 추가합니다.$ oc label persistentvolumeclaim <PVC_name> \ controller.devfile.io/mount-to-devworkspace=true선택 사항: 주석을 사용하여 PVC가 마운트되는 방법을 구성합니다.
Expand 표 7.1. 선택적 주석 주석 설명 controller.devfile.io/mount-path:PVC의 마운트 경로입니다.
기본값은
/tmp/ <PVC_name>입니다.controller.devfile.io/read-only:'true'또는'false'로 설정하여 PVC를 읽기 전용으로 마운트할지 여부를 지정합니다.기본값은
'false'로, PVC가 읽기/쓰기로 마운트됩니다.
예 7.2. 읽기 전용 PVC 마운트
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: <pvc_name>
labels:
controller.devfile.io/mount-to-devworkspace: 'true'
annotations:
controller.devfile.io/mount-path: </example/directory>
controller.devfile.io/read-only: 'true'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: <storage_class_name>
volumeMode: Filesystem