본문 바로가기
cloud/k8s(문제풀이)

[따배쿠 CKA] 19. Persistent volume 생성

by mozi2 2022. 8. 12.
반응형

*Persistent Volume 이란? [14-1따배쿠 강의볼것]

: 관리자가 프로비저닝하거나 스토리지 클래스 를 사용하여 동적으로 프로비저닝한 클러스터의 스토리지 이다. 

: pv 에는 size, access, storage class, claim 정책 등이 포함된다.

 

*사전 세팅

1. vi pv1.yaml

 

apiVersion: v1 
kind: PersistentVolume 
metadata: 
  name: pv1 
spec: 
  capacity: 
     storage: 1Gi 
  volumeMode: Filesystem 
  accessModes: 
    - ReadWriteMany 
    - ReadOnlyMany 
  persistentVolumeReclaimPolicy: Recycle 
  storageClassName: app-hostpath-sc 
  hostPath: 
      path: /srv/app-config

 

 

2. vi pv2.yaml 생성하기

apiVersion: v1 
kind: PersistentVolume 
metadata: 
  name: pv2
spec: 
  capacity: 
     storage: 1Gi 
  volumeMode: Filesystem 
  accessModes: 
    - ReadWriteMany 
    - ReadOnlyMany 
  persistentVolumeReclaimPolicy: Recycle 
  storageClassName: app-hostpath-sc 
  hostPath: 
      path: /srv/app-config

Q. Kubectl config use-context k8s

 - Create a persistent volume with name app-config, of capacity 1Gi and access mode ReadWritemMany.
- storageClass: az-c
- The type of volume is hostPath and its location is /srv/app-config.

1. vi 생성하기 

vi app-config.yaml

2.확인

k apply -f app-config.yaml

 

 

 

 

 

https://kubernetes.io/docs/concepts/storage/volumes/

 

Volumes

On-disk files in a container are ephemeral, which presents some problems for non-trivial applications when running in containers. One problem is the loss of files when a container crashes. The kubelet restarts the container but with a clean state. A second

kubernetes.io

 

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

 

* 본 게시글은 "TTABAE-LEARN" 을 보고 정리한 내용입니다.

728x90
반응형