트래픽 관리
개요
트래픽 관리 아키텍처
ServiceProfile
ServiceProfile 구조
apiVersion: linkerd.io/v1alpha2
kind: ServiceProfile
metadata:
name: web-service.my-app.svc.cluster.local
namespace: my-app
spec:
# 라우트 정의
routes:
- name: GET /api/users
condition:
method: GET
pathRegex: /api/users(/.*)?
# 이 라우트는 재시도 가능
isRetryable: true
# 타임아웃 설정
timeout: 5s
- name: POST /api/orders
condition:
method: POST
pathRegex: /api/orders
# POST 요청은 기본적으로 재시도하지 않음
isRetryable: false
timeout: 10s
- name: GET /health
condition:
method: GET
pathRegex: /health
isRetryable: true
timeout: 1s
# 재시도 예산 (전체 요청 대비 재시도 비율)
retryBudget:
retryRatio: 0.2 # 최대 20% 추가 요청
minRetriesPerSecond: 10 # 초당 최소 재시도 수
ttl: 10s # 예산 리셋 주기라우트 조건
ServiceProfile 자동 생성
상세 예제
재시도 (Retries)
재시도 동작 방식
재시도 조건
재시도 예산
재시도 모니터링
타임아웃 (Timeouts)
라우트별 타임아웃
타임아웃 동작
로드 밸런싱
EWMA 알고리즘
특성
설명
로드 밸런싱 모니터링
TrafficSplit (SMI)
기본 구조
카나리 배포
TrafficSplit 서비스 설정
TrafficSplit 모니터링
HTTPRoute (Gateway API)
HTTPRoute 기본 구조
고급 HTTPRoute 설정
Circuit Breaking (장애 격리)
Failure Accrual 동작
상태
설명
서킷 브레이커 설정
장애 격리 모니터링
Flagger를 사용한 자동 카나리 배포
Flagger 설치
Canary 리소스 정의
Flagger 배포 흐름
Flagger 메트릭 템플릿
Flagger 모니터링
헤더 기반 라우팅
디버깅용 헤더 라우팅
트래픽 관리 모범 사례
1. ServiceProfile 정의 전략
2. 점진적 트래픽 전환
3. 타임아웃 튜닝
다음 단계
참고 자료
마지막 업데이트