[Object] Deployment - Probe

메모장·2024년 9월 4일

kubernetes

목록 보기
5/6

startupProbe:                               # 컨테이너의 시작 상태를 확인하는 프로브
  httpGet:                                  # HTTP GET 요청을 사용 
    path: "/startup"                        # 요청할 경로
    port: 8080                              # 요청할 포트
  periodSeconds: 10                         # 프로브 실행 주기
  successThreshold: 1                       # 프로브 성공 판단 횟수
  failureThreshold: 10                      # 실패로 간주하기 전 허용하는 최대 실패 횟수
readinessProbe:                             # 컨테이너의 준비 상태를 확인하는 프로브
  httpGet:
    path: "/readiness"
    port: 8080
  periodSeconds: 10
  successThreshold: 1
  failureThreshold: 2                       # 3번 실패하면 외부 트래픽 차단
livenessProbe:                              # 컨테이너의 생존 상태를 확인하는 프로브
  httpGet:
    path: "/liveness"
    port: 8080
  periodSeconds: 10
  successThreshold: 1
  failureThreshold: 2

starupProbe

  • pod 시작 후 successThreshold 값만큼 연속적으로 성공하면 startProbe 중지 후 redinessProbe와 livenessProbe를 동작 시킴
  • failureThreshold 횟수만큼 실패하면 pod 재기동
  • failureThreshold 값이 1이면 pod가 무한 재기동 상태가 될수 있음

readinessProbe

  • 성공하면 pod가 외부 트래픽을 받을 수 있는 상태로 변경 (Service와 pod 연결)
  • 실패하면 외부 트래픽 차단
  • API뿐 아니라, 아래와 같이 파일 존재 유무로 판단 할 수 있음.
readinessProbe:
  exec:
    command: ["cat", "/usr/src/myapp/datasource/postgresql-info.yaml"]
  periodSeconds: 10
  failureThreshold: 3

livenessProbe

  • APP이 살아있는지 지속적으로 체크
  • 실패하면 APP(pod) 재기동 수행
  • 실패 판단 주기(periodSeconds x failureThreshold)를 readinessProbe 보다 길게 하는 편
profile
어수선한 메모장

0개의 댓글