2023. 3. 7. 08:46ㆍDevOps/CKA Test 준비
PV(persistentVolume) 생성하기
pv를 생성하시오
작업 클러스터 : hk8s
name : pv001
size : 1Gi
access mode : RWX
volume tpye : hostpath
path : /tmp/app-config
작업 클러스터 확인하기
kubectl config use-context hk8s
yaml 파일 생성하기
appVersion : v1
kind : persistentVolume
metadata:
name: pv001
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: /tmp/app-config
2. 해당 yaml 실행하기
PVC생성하기
pvc를 생성한 후 해당 pvc를 mount 하는 pod를 생성하시오.
작업 클러스터 : k8s
namep: pv-volume
class : app-hostpath-sc
capacity: 10Mi
pod
name: web-server-pod
image : nginx
mount path: /usr/share/nginx/html
accessModes:ReadWriteMany
pv할당
pod 실행
volume 선언
mount
1. 작업 클러스터로 이동
kubectl config use-context k8s
2. pv생성
appVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pv-volume
spec:
accessMode:
- ReadWriteMany
resources:
requests:
storage: 10Mi
storageClassName: app-hostpath-sc
3.pvc 생성
kubectl apply -f pvc.yaml
4.pvc와 mount 하는 pod 생성
apiVersion: v1
kind: pod
metadata:
name: web-server-pod
spec:
containers:
- name: myfrontend
image: nginx
volumeMount:
- mountPath: "/usr/share/nginx/html"
namep: mypd
volumes:
- name: mypd
persistentVolumeClaim:
claimName: pv-volume
'DevOps > CKA Test 준비' 카테고리의 다른 글
16.CKA-ClousterTroubleshooting (0) | 2023.03.14 |
---|---|
15. CKA-Logs (0) | 2023.03.08 |
13.CKA-Volume mount (0) | 2023.03.07 |
12.CKA-KUBE-DNS (0) | 2023.03.07 |
11. CKA-ingress (0) | 2023.02.10 |