inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

인프런 워밍업 클럽 4기 DevOps 미션 2.

chano01794
1

응용 1

 

답

          startupProbe:
            httpGet:
              path: /startup
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 5
            successThreshold: 10
            failureThreshold: 1# 36

image

 

응용 2

// 부하 증가 API - (App 내부 isAppReady와 isAppLive를 False로 바꿈)
curl http://192.168.56.30:31231/server-load-on

// 외부 API 실패
curl http://192.168.56.30:31231/hello

// 부하 감소 API - (App 내부 isAppReady와 isAppLive를 True로 바꿈)
curl http://192.168.56.30:31231/server-load-off

답

  timeoutSeconds: 1        # 1초 안에 응답 없으면 실패로 간주
  periodSeconds: 10        # 10초마다 헬스체크
  successThreshold: 1      # 1번만 성공하면 성공으로 인정 > 이건 없어도 기본값 1이랬음 
  failureThreshold: 3      # 3번 연속 실패 시 컨테이너 재시작


          livenessProbe:
            httpGet:
              path: /liveness
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 60
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /readiness
              port: 8080
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
liveness 프로브 : APP 잘 살아있니? 
- 실패시 장애라고 판단하고 Pod 를 재기동

readiness 프로브 : 외부 트래픽 넣어도 괜찮니? 
- 성공 나오면 Service <> Pod 연결
- 중간에 실패 나오면 다시 연결 해제하고, 성공 뜨면 또다시 재연결

image3분 지나고 pod 재시동 ( 로그 확인 )

30초 지나고 외부 api 꺼짐

image

파드 다시 켜지고 Pod 들어가서 부하 줄이는 코드 > 외부에서 api 호출했을 때에 잘 반응

image

>> 부하가 많이 걸릴 때에, Pod를 재기동하기 보다는 일단 외부 api 호출을 막아서 app의 부담을 덜고

>> 3분동안 처리했을 때에도 처리가 다 안되면 pod 재기동? 결국은 read 보다 live 를 많이 잡는게 좋을듯

 

응용 3

답

          readinessProbe:
            exec:
              command: ["cat", "/usr/src/myapp/datasource/postgresql-info.yaml"]
            periodSeconds: 10
            failureThreshold: 3

 

 

** 강사님 답 보고 알아낸 사실

☞ HTTP 명령이 아니기 때문에 로그에서 Readiness probe가 찍히는건 볼 수 없습니다.

☞ 하지만 command 명령에 실패(해당 파일이 없을 때)하면 아래와 같이 event로 실패 로그를 볼 수 있어요

image

          readinessProbe:
            exec:
              command:
                - cat
                - /usr/src/myapp/datasource/postgresql-info.yaml
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3

 

답변 0