Kubernetes (k8s)
[k8s] Persistent Volume
moveho
2023. 4. 20. 22:22
1. PV ( Persistent Volume ) 란?
Persistent Volume (PV)은 Kubernetes의 스토리지 추상화로, 이를 사용하는 pod 에서 storage 구성을 분리할 수 있습니다.
Persistent Volume 은 Cluster 관리자가 동적으로 프로비저닝하거나 정적으로 구성할 수 있는 클러스터 전체 리소스입니다. Pod 와 Storage 백엔드 사이에 추상화 계층을 제공하여 애플리케이션의 유연성과 이식성을 높일 수 있습니다.
2. Pv 예제
Persistent Volume 구성해보기
* Create a persistent volume with name app-config, of capacity 1Gi and access mode ReadWriteMany
* StorageClass: az-c
* The type of volume is hostPath and its location is /srv/app-config
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-config
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: az-c
hostPath:
path: /srv/app-config
type: Directory
3. 결과
root@k8s-master:~/cka30# kubectl apply -f 19.yaml
persistentvolume/app-config created
root@k8s-master:~/cka30# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
app-config 1Gi RWX Retain Available az-c 4s
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
Persistent Volumes
This document describes persistent volumes in Kubernetes. Familiarity with volumes is suggested. Introduction Managing storage is a distinct problem from managing compute instances. The PersistentVolume subsystem provides an API for users and administrator
kubernetes.io