Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- ipv6
- ACL
- GLBP
- crontab
- CKA
- ripng
- eigrp
- DHCP
- vrrp
- Chrony
- stp
- 라우터
- rip
- Redistribute
- 스위치
- 헤더
- Etherchannel
- OSPF
- OSI 7 layer
- Vlan
- tunneling
- 명령어
- Inter VLAN
- eigrpv2
- 장비
- ospfv3
- NAT
Archives
- Today
- Total
Net Eng
[CKA] - Persistent Volume Claim 사용하는 Pod 운영 본문
[선수 작업]
kubectl config set-context k8s --user=kubernetes-admin --cluster=kubernetes
mkdir -p /srv/pv{1,2}
echo "/srv/pv1/index.html" > /srv/pv1/index.html
echo "/src/pv2/index.html" > /srv/pv2/index.html
kubectl apply -f - <<EOF
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv1
spec:
capacity:
storage: 10Mi
accessModes:
- ReadWriteMany
storageClassName: app-hostpath-sc
hostPath:
path: /srv/pv1
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv2
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: app-hostpath-sc
hostPath:
path: /srv/pv2
EOF
[문제]
- 작업 클러스터: k8s
- 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.
[풀이]
kubectl config use-context k8s
* k8s 클러스터 사용
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: app-volume
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Mi
storageClassName: app-hostpath-sc
* yaml 파일로 PersistantVolumeClaim 작성
kubectl apply -f app-config-pv.yaml
* yaml 파일 실행
kubectl get pvc
* pvc 확인
apiVersion: v1
kind: Pod
metadata:
name: web-server-pod
spec:
containers:
- name: myfrontend
image: nginx
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: mypd
volumes:
- name: mypd
persistentVolumeClaim:
claimName: app-volume
* yaml 파일로 Pod 작성
kubectl apply -f app-config-pod.yaml
* yaml 파일 실행
kubectl describe pods web-server-pod
* Pod 확인
[참고]
퍼시스턴트 볼륨
이 페이지에서는 쿠버네티스의 퍼시스턴트 볼륨 에 대해 설명한다. 볼륨에 대해 익숙해지는 것을 추천한다. 소개 스토리지 관리는 컴퓨트 인스턴스 관리와는 별개의 문제다. 퍼시스턴트볼륨 서
kubernetes.io
'Cloud > Kubernetes' 카테고리의 다른 글
[CKA] - Ingress 구성 (0) | 2024.01.23 |
---|---|
[CKA] - Check Resource Information (1) | 2024.01.23 |
[CKA] - Persistent Volume 생성 (0) | 2024.01.22 |
[CKA] - Secret 운영 (0) | 2024.01.22 |
[CKA] - ConfigMap 운영 (1) | 2024.01.22 |