DevOps · 1 min read

Kubernetes에서 Zero-Downtime 배포 구현하기

실제 운영 환경에서 서비스 중단 없이 배포하기 위한 전략과 설정

김현우

Kubernetes Zero-Downtime 배포

운영 중인 서비스를 끊김 없이 배포하는 건 생각보다 까다롭다.

핵심 설정

1. Readiness Probe 정확히 설정

readinessProbe:
httpGet:
path: /health/ready
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3

2. PodDisruptionBudget 설정

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: api-pdb
spec:
minAvailable: 2
selector:
matchLabels:
  app: api

3. Graceful Shutdown

preStop hook으로 커넥션 정리 시간 확보:

lifecycle:
preStop:
exec:
  command: ["sh", "-c", "sleep 10"]

실수했던 것

처음에 readinessProbe 없이 배포했다가, 아직 준비 안 된 Pod로 트래픽이 가서 장애가 났다. Probe는 필수다.

이 글 공유하기

댓글 0개

댓글을 작성하려면 로그인이 필요합니다.

로그인하기

아직 댓글이 없습니다

첫 번째 댓글을 남겨보세요!