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

[따배쿠CKA]20. Persistent Volume Clame 을 사용하는 Pod 운영

by mozi2 2022. 8. 12.
반응형

[k8s docs: pvc -> claims as] 

 

*PVC 란?

: 다양한 형태의 PV 가 준비가 되어 있으면 쿠버네티스는 가장 적절한 PVC 로 Bound 해준다. 

 그리고 이 PVC 를 마운트해서 파드에서 사용한다. 

 

Q. Cluster: kubectl config use-context k8s

Create a new Persistent Volume Clame :
  - Name: app-volume
  - StorageClass: app-hostpath-sc
  - Capacity: 10Mi

Create a new Pod which mounts hte Persistent Volume Clame as a volume
  - Name: web-server-pod
  - Image: nginx
  - MountPath: /usr/share/nginx/html

Configure the new Pod the have ReadWriteMany access on the volume

1. pvc 생성하기 

vi app-volume
k apply -f app-volume
k get pvc 

* accessModes 질문에 맞게 수정하기 

 

2. 할당 확인

k get pv
k get pvc

: pvc가 10Mi 이지만 pvc 의 용량이다 1Gi 여서 1Gi 로 선택

: pvc 스펙에 맞게 pv 가 pv1으로 할당 됨

 

3. 파드 만들기 

vi web-server-pod
k apply -f web-server-pod.yaml

4. 확인하기

k describe pod web-server-pod 

 

 

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
반응형