Application 기능으로 이해하기 - Probe

Moongchi·2025년 6월 1일

kubernetes

목록 보기
6/14

Probe

  • 쿠버네티스에서 Probe는 컨테이너의 상태를 체크하여, 상태에 따라 다음과 같은 동작을 수행합니다.
  • startupProbe 성공 이후 → readinessProbe, livenessProbe가 실행됨
  • 확인 방식
    - httpGet : HTTP 경로 요청
    - tcpSocket : 포트가 열려 있는지 검사
    - exec : 쉘 명령 실행 결과 검사
  1. startupProbe: 앱이 시작 중인지 확인 (재기동 판별)
  2. readinessProbe: 요청을 받을 준비가 되었는지 확인 (서비스 연결 판별)
  3. livenessProbe: 앱이 살아있는지 확인 (재기동 판별)

1. startupProbe

설명

  • 애플리케이션 초기 기동이 느릴 때 사용
  • 이 probe가 성공하기 전까지는 livenessProbe, readinessProbe실행되지 않음
  • 지정된 조건을 만족하지 않으면 컨테이너가 재시작됨

주요 필드

  • failureThreshold: 실패 허용 횟수
  • periodSeconds: 검사 주기

예시

startupProbe:
  httpGet:
    path: /healthz
    port: 8080
  failureThreshold: 30     # 30번 실패하면 재시작
  periodSeconds: 10        # 10초마다 실행

2. readinessProbe

설명

  • 앱이 외부 트래픽을 받을 준비가 되었는지 확인
  • 실패하면 해당 Pod은 Service 엔드포인트에서 제외됨
  • 앱이 일시적으로 응답하지 않아도 재시작하지 않음

주요 필드

  • initialDelaySeconds : 시작 전 대기 시간
  • periodSeconds, failureThreshold

예시

readinessProbe:
  httpGet:
    path: /ready
    port: 8080
  initialDelaySeconds: 5 	# 시작 전 대기
  periodSeconds: 5 			# 5초마다 실행
  failureThreshold: 3		# 3회 실패 시 서비스 연결 중단

3. livenessProbe

설명

앱이 정상적으로 실행 중인지 확인
반복적으로 실패하면 컨테이너를 자동 재시작

주요 필드

  • failureThreshold, periodSeconds, timeoutSeconds

예시

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  periodSeconds: 10			# 10초마다 확인
  failureThreshold: 3		# 3회 실패 시 재기동
  timeoutSeconds: 2			# 

0개의 댓글