volumeMounts
emptyDir
volumes:
- name : story-volume
hostPath:
path: /data
type: DirectoryOrCreate
DirectoryOrCreate
: 존재하는 디렉토리 또는 아직 존재하지 않는다면 생성하도록 설정# host-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: host-pv
spec:
capacity:
storage: 1Gi
volumeMode: Filesystem
storageClassName: standard
accessModes:
- ReadWriteOnce
hostPath:
path: /data
type: DirectoryOrCreate
# host-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: host-pvc
spec:
volumeName: host-pv
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 1Gi
Filesystem vs Block Storage
https://www.computerweekly.com/feature/Storage-pros-and-cons-Block-vs-file-vs-object-storage
볼륨과 클레임 라이프 사이클 : 쿠버네티스 공식 사이트 참고
https://kubernetes.io/ko/docs/concepts/storage/persistent-volumes/
spec:
containers:
- name: story
image: academind/kub-data-demo:1
env:
- name: STORY_FOLDER
value: 'story'
vloumeMounts:
...
env의 내용을 ConfigMaps를 통해 설정할 수 있다.
spec:
containers:
- name: story
image: academind/kub-data-demo:1
env:
- name: STORY_FOLDER
valueFrom:
configMapKeyRef:
name: data-store-env
key: folder
vloumeMounts:
...