본문 바로가기
Compute/kubernetis

[CKA] 09. persistent volume | persistent volume claim 생성

by 조청유곽 2025. 1. 14.
반응형

01. 특정 조건의 persistent volume을 생성한다. | capacity 2Gi / accss mode는 ReadWriteMany / type은 hostpath 

 

[solve]

[root@k8s-master ~]# vi 16-test.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: app-data
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/srv/app-data"

[root@k8s-master ~]# kubectl apply -f 16-test.yaml 
persistentvolume/app-data created
[root@k8s-master ~]# kubectl describe pv/app-data
Name:            app-data
Labels:          type=local
Annotations:     <none>
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    manual
Status:          Available
Claim:           
Reclaim Policy:  Retain
Access Modes:    RWX
VolumeMode:      Filesystem
Capacity:        2Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /srv/app-data
    HostPathType:  
Events:            <none>
[root@k8s-master ~]#

 

반응형