[미션4] PVC/PV, Deployment, Service, HPA 이해하기
▶PV, PVC😆local, hostPath 미션을 진행해보자!😆1) local 동작 확인 API - 파일 생성http://192.168.56.30:31231/create-file-podhttp://192.168.56.30:31231/create-file-pv// Container 임시 폴더 확인 [root@k8s-master ~]# kubectl exec -n anotherclass-123 -it <pod-name> -- ls /usr/src/myapp/tmp // Container 영구저장 폴더 확인 [root@k8s-master ~]# kubectl exec -n anotherclass-123 -it <pod-name> -- ls /usr/src/myapp/files/dev // master node 폴더 확인 [root@k8s-master ~]# ls /root/k8s-local-volume/1231// Pod 삭제 [root@k8s-master ~]# kubectl delete -n anotherclass-123 pod <pod-name>Pod 삭제 후 master node 폴더 확인했다.tmp삭제 되었고 dev에 있던 data는 남아 있다! 2) hostPath 동작 확인▶ Deployment😃Deployment 미션 진행 시작!😃1) RollingUpdate 하기// 1) HPA minReplica 2로 바꾸기 (이전 강의에서 minReplicas를 1로 바꿔놨었음) kubectl patch -n anotherclass-123 hpa api-tester-1231-default -p '{"spec":{"minReplicas":2}}'// 2) 지속적으로 Version호출 하기 (업데이트 동안 리턴 값 관찰) while true; do curl http://192.168.56.30:31231/version; sleep 2; echo ''; done; // 3) 별도의 원격 콘솔창을 열어서 업데이트 실행 kubectl set image -n anotherclass-123 deployment/api-tester-1231 api-tester-1231=1pro/api-tester:v2.0.0 kubectl set image -n anotherclass-123 deployment/api-tester-1231 별도의 원격 콘솔창 열어서 업데이트 실행v1.0.0 , v2.0.0 반복되면서 점차 App Version이 업데이트 되고 있다!😁업데이트 완료!! 2) RollingUpdate (maxUnavailable: 0%, maxSurge: 100%) 하기maxUnavailable:25%->0% 수정 maxSurge:25%->100% 수정3) Recreate 하기4) Rollback ▶ Service1) Pod 내부에서 Service 명으로 API 호출 (서비스 디스커버리)2) Deployment에서 Pod의 ports 전체 삭제, Service targetPort를 http -> 8080으로 수정그리고 다시 Pod 내부에서 Service 명으로 API 호출▶HPA1) 부하 발생 & 확인2) behavior 미사용으로 적용 & 부하 발생 미션 끝~~~!! 길고 길었던 이번 미션… 그래도 이렇게 정리 딱! 하고 나니까… 뿌듯함이 솟아나는 중💛수고했당 나 자신 ✨