IT/Kubernetes

[CKA] PV(PersistentVolume) 란?

어린이개발자 2025. 11. 22. 12:09

이번엔 PV(PersistentVolume) 에 대해 정리하고자 한다.

 

1. 정의

- 클러스터에서 독립적으로 관리되는 스토리지 리소스

  > Pod 의 라이프 사이클과 독립적인 영구 스토리지(볼륨)을 의미하며, 노드나 Pod 가 재시작되거나 삭제되어도 데이터가 유지

 

2. 특징

- 클러스터 리소스

  > Pod 가 만들어지기 전/후와 상관 없이 클러스터 레벨에서 존재

- 실제 스토리지와 연결되어 있음

- PVC 와 바인딩 되어 사용

  > Pod 는 PV 를 직접 사용하지 않고 PVC(PersistentVolumeClaim) 이라는 요청을 통해 간접적으로 사용

 

3. 관련 문제 (KodeKloud 에서 제공하는 샘플 문제를 정리)

- Configure a volume to store these logs at /var/log/webapp on the host.

kubectl get po webapp -o yaml > webapp.yaml
apiVersion: v1
kind: Pod
metadata:
  name: webapp
spec:
  containers:
    volumeMounts:
    - mountPath: /log
      name: log-volume

  volumes:
  - name: log-volume
    hostPath:
      path: /var/log/webapp
kubectl replace -f webapp.yaml --force

 

- Create a Persistent Volume with the given specification.

vi pv-log.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-log
spec:
  persistentVolumeReclaimPolicy: Retain
  accessModes:
    - ReadWriteMany
  capacity:
    storage: 100Mi
  hostPath:
    path: /pv/log
kubectl create -f pv-log.yaml

 

- What is the Reclaim Policy set on the Persistent Volume pv-log?

kubectl get pv

 

4. 출처

- https://learn.kodekloud.com/user/courses/udemy-labs-certified-kubernetes-administrator-with-practice-tests

'IT > Kubernetes' 카테고리의 다른 글

[CKA] Service 란?  (0) 2025.11.24
[CKA] NetworkPolicy 란?  (0) 2025.11.22
[CKA] StorageClass 란?  (0) 2025.11.21
[CKA] PriorityClass 란?  (0) 2025.11.21
[CKA] Deployment 란?  (0) 2025.11.21