728x90
반응형
> startupProbe(App 초기화에 대한 점검)
- App기동시 API를 호출(httpGet:path)하여, 10초의 간격(periodSeconds)으로 총 10번의 실패(failureThreshold) 전에 1번의 성공(successThreshold) 응답(200 OK)을 받으면 중지.
- 이후 readinessProbe와 livenessProbe 실행
> livenessProbe(App 상태 점검)
- App이 살아 있는지 검사. 2번 실패(failureThreshold)하면 pod 재기동
> readinessProbe(외부 API 접근 가능 여부 점검)
- 외부 트래픽을 pod가 받을수 있는 상태인지 검사하면서 서비스가 활성화. 즉 Service(selector)와 Pod(labels) 연결.
ㅁ 실습
> 실습 전 사전 준비작업 : HPA(HorizontalPodAutoscaler)는 2~4로 설정되어있고, HPA -> Deployment에 영향을 주기때문에 이를 1로 변경하여, 1개의 pod의 log만 확인 할 수 있도록 설정
// HPA minReplica 1로 바꾸기 - Master Node
kubectl patch -n anotherclass-123 hpa api-tester-1231-default -p '{"spec":{"minReplicas":1}}'
> Grafana 접속 후 Loki에 Pod 로그 화면 설정
// Grafana 접속 IP
http://192.168.56.30:30001/
> Pod 삭제
> Application 로그 확인
> Application 동작 중심의 Probe 이해
> API를 통한 Probe 동작 확인
- master node에서 아래 명령어로 테스트
// 1번 API - 외부 API 실패
curl http://192.168.56.30:31231/hello
// 2번 API
// 외부 API 실패
curl http://192.168.56.30:31231/hello
// 내부 API 성공
kubectl exec -n anotherclass-123 deploy/api-tester-1231 -it -- curl localhost:8080/hello
kubectl exec -n anotherclass-123 -it <my-pod-name> -- curl localhost:8080/hello
// 3번 API - 외부 API 성공
curl http://192.168.56.30:31231/hello
// 4번 API
// 트래픽 중단 - (App 내부 isAppReady를 False로 바꿈)
curl http://192.168.56.30:31231/traffic-off
// 외부 API 실패
curl http://192.168.56.30:31231/hello
// 트래픽 재개 - (App 내부 isAppReady를 True로 바꿈)
kubectl exec -n anotherclass-123 deploy/api-tester-1231 -it -- curl localhost:8080/traffic-on
// 5번 API - 장애발생 (App 내부 isAppLive를 False로 바꿈)
curl http://192.168.56.30:31231/server-error
> 실습환경 삭제
[root@k8s-master ~]# kubectl delete ns anotherclass-123
[root@k8s-master ~]# kubectl delete pv api-tester-1231-files
> 참고 URL
https://cafe.naver.com/kubeops/36
728x90
반응형
'Container > Kubernetes' 카테고리의 다른 글
[Kubernetes] Application 기능으로 이해하기 - Deployment (0) | 2024.06.05 |
---|---|
[Kubernetes] Application 기능으로 이해하기 - PV/PVC (0) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - Configmap, Secret (0) | 2024.05.29 |
[Kubernetes] Object 그려보며 이해하기 (0) | 2024.05.24 |
[Kubernetes] 표준 생태계 (0) | 2024.05.23 |