이 게시물은 아래 강의를 참고 하였습니다.
참고 강의 https://www.youtube.com/watch?v=KdATmTulf7s&list=PLApuRlvrZKojqx9-wIvWP3MPtgy2B372f&index=1
문제)
- Create a new PersistentVolumeClaim:
Name: app-volume
StorageClass: app-hostpath-sc
Capacity: 10Mi
- Create a new Pod which mounts the PersistentVolumeClaim as a volume:
Name: web-server-pod
Image: nginx
Mount path: /usr/share/nginx/html
- Configure the new Pod to have ReadWriteMany access on the volume.
풀이)
$ sudo vi app-volume-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: app-volume
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Mi
storageClassName: app-hostpath-sc
$ sudo kubectl apply -f app-volume-pvc.yaml
$ sudo vi web-server-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: web-server-pod
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: mypd
volumes:
- name: mypd
persistentVolumeClaim:
claimName: app-volume
$ sudo kubectl apply -f web-server-pod.yaml
$ sudo kubectl describe pods web-server-pod
'k8s' 카테고리의 다른 글
CKA 준비 (22) Kubernetes Upgrade (0) | 2022.06.24 |
---|---|
CKA 준비 (21) Check Resource Information (1) | 2022.06.24 |
CKA 준비 (19) Persistent Volume 생성 (0) | 2022.06.17 |
CKA 준비 (18) Ingress 구성 (2) | 2022.06.11 |
CKA 준비 (17) Secret 운영 (0) | 2022.06.11 |