본 한국어 번역은 사용자 편의를 위해 제공되는 기계 번역입니다. 영어 버전과 한국어 버전이 서로 어긋나는 경우에는 언제나 영어 버전이 우선합니다.
샘플 애플리케이션 배포
스토리지 클래스와 PVC가 생성되면 PV를 포드에 마운트할 수 있습니다. 이 섹션에서는 PV를 포드에 연결하는 명령과 구성의 예를 나열합니다.
단계
-
볼륨을 포드에 마운트합니다.
kubectl create -f pv-pod.yaml다음 예에서는 PVC를 포드에 부착하기 위한 기본 구성을 보여줍니다. 기본 구성:
kind: Pod apiVersion: v1 metadata: name: pv-pod spec: volumes: - name: pv-storage persistentVolumeClaim: claimName: basic containers: - name: pv-container image: nginx ports: - containerPort: 80 name: "http-server" volumeMounts: - mountPath: "/my/mount/path" name: pv-storage다음을 사용하여 진행 상황을 모니터링할 수 있습니다. kubectl get pod --watch. -
볼륨이 마운트되었는지 확인하세요.
/my/mount/path.kubectl exec -it pv-pod -- df -h /my/mount/path
Filesystem Size Used Avail Use% Mounted on 192.168.188.78:/trident_pvc_ae45ed05_3ace_4e7c_9080_d2a83ae03d06 1.1G 320K 1.0G 1% /my/mount/path
이제 Pod를 삭제할 수 있습니다. Pod 애플리케이션은 더 이상 존재하지 않지만 볼륨은 그대로 유지됩니다.
kubectl delete pod pv-pod