TIL

Liveness, Readiness, Startup Probes

Liveness Probe

exec

livenessProbe:
  exec:
    command: ["cat", "/tmp/healthy"]
  initialDelaySeconds: 5   # 첫 probe까지 대기
  periodSeconds: 5          # 이후 검사 주기

HTTP

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 3
  periodSeconds: 3

TCP

livenessProbe:
  tcpSocket:
    port: 8080
  initialDelaySeconds: 15
  periodSeconds: 10

gRPC

livenessProbe:
  grpc:
    port: 2379
  initialDelaySeconds: 10

Named port

ports:
- name: liveness-port
  containerPort: 8080

livenessProbe:
  httpGet:
    path: /healthz
    port: liveness-port    # 포트 번호 대신 이름

Startup Probe

startupProbe:
  httpGet:
    path: /healthz
    port: liveness-port
  failureThreshold: 30    # 최대 30번 시도
  periodSeconds: 10        # 10초 간격 → 최대 300초(5분) 대기

livenessProbe:
  httpGet:
    path: /healthz
    port: liveness-port
  failureThreshold: 1     # startup 이후엔 빠르게 감지
  periodSeconds: 10

Readiness Probe

readinessProbe:
  exec:
    command: ["cat", "/tmp/healthy"]
  initialDelaySeconds: 5
  periodSeconds: 5

liveness와 readiness의 관계