🔥딱 8일간! 인프런x토스x허먼밀러 역대급 혜택

인프런 워밍업 클럽 4기 DevOps - 응용과제 미션 2

응용1 : startupProbe가 실패 되도록 설정해서 Pod가 무한 재기동 상태가 되도록 설정해 보세요.

(여러분들이 가장 많이 겪게될 Pod 에러입니다)

namespace: anotherclass-123

deployment: api-tester-1231

startupProbe:
  httpGet:
    path: /startup
    port: 8080
    scheme: HTTP
  timeoutSeconds: 1
  periodSeconds: 5
  successThreshold: 1
  failureThreshold: 1 # 여기를 낮게 수정

결과:

image

image

 

응용2 : 일시적 장애 상황(App 내부 부하 증가)가 시작 된 후, 30초 뒤에 트래픽이 중단되고, 3분 뒤에는 App이 재기동 되도록 설정해 보세요.

(아래 API를 날리면 readinessProbe와 livenessProbe가 동시에 실패하게 됩니다)

// 부하 증가 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

livenessProbe과 readinessProbe을 다음과 같이 수정

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

결과:

image

응용3 : Secret 파일(/usr/src/myapp/datasource/postgresql-info.yaml)이 존재하는지 체크하는 readinessProbe를 만들어 보세요.

(꼭 API를 날리는 것만이 readinessProbe 활용의 전부는 아닙니다)

 

readinessProbe을 다음과 같이 수정

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

결과:

없는 경로를 지정할 경우

image

 

댓글을 작성해보세요.

채널톡 아이콘