티스토리 뷰

반응형

 

 

Destination Rule

Configuration affecting load balancing, outlier detection, etc.

istio.io


apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: DestinationRule-example
spec:
  host: svc-apply-example
  trafficPolicy: 

    loadBalancer:
      simple: ROUND_ROBIN

    outlierDetection:
      consecutive5xxErrors: 5
      consecutiveGatewayErrors: 0
      interval: 10s
      baseEjectionTime: 30s
      maxEjectionPercent: 10
      minHealthPercent: 50

    connectionPool:
      http:
        http1MaxPendingRequests: 4294967295
        http2MaxRequests: 4294967295
        maxRequestsPerConnection: 0
        maxRetries: 4294967295
        idleTimeout: 1h
      tcp:
        maxConnections: 4294967295
        connectionTimeout: 10s
    # tls: tls mode
    portLevelSettings:
      - port:
          number: 80
        loadBalancer:
          simple: LEAST_CONN
      - port:
          number: 9080
        loadBalancer:
          simple: RANDOM
  
  subsets:
  - name: testversion
    labels:
      version: v3
    trafficPolicy:
      loadBalancer:
        simple: RANDOM
      outlierDetection:
        consecutive5xxErrors: 15
        consecutiveGatewayErrors: 0
        interval: 30s
      connectionPool:
          http:
            http1MaxPendingRequests: 100
            http2MaxRequests: 100

 

왠지 모르겠는데 Tistory의 indent가 먹질 않아 사진으로 대체합니다.

- 사진으로는 내용이 제대로 안보이신다면, 아래에 indent가 없는 걸 참조해서 봐주세요 🥲

 

* 은 default value를 의미합니다.

  • trafficPolicy: 트래픽 정책 정의
    • loadBalancer: Load balancer 알고리즘 설정
      • simple: ROUND_ROBIN, LEAST_CONN, RANDOM, PASSTHROUGH 지원 (* ROUND_ROBIN)
        • ROUND_ROBIN: 라운드 로빈 알고리즘
        • LEAST_CONN: active request가 제일 적은 host 선택
        • RANDOM: 무작위 host 선택
        • PASSTHROUGH: Load balancing 하지 않고, 호출자가 요청한 IP로 연결
      • consistentHash: Consistent Hash-based load balancing. HTTP Header, cookie 등을 기반으로 soft session affinity 제공. HTTP 연결에만 적용된다.
        • httpHeaderName
        • httpCookie
        • useSourceIp
        • httpQueryParameterName
        • minimumRingSize
    • outlierDetection : Load balancing pool에서 Unhealthy hosts 판단 및 제외 (circuit open) 규칙 정의
      • consecutive5xxErrors: host가 connection pool에서 제외되는 5xx 오류 수 (* 5)
      • consecutiveGatewayErrors: host가 connection pool에서 제외되는 게이트웨이 오류 수. 502, 503, 504는 Gateway 오류로 판단된다. (* 0 - disable)
        • consecutiveGatewayErrors 는 consecutive5xxErrors 에 포함되어져 동작합니다. 그래서 만약 consecutiveGatewayErrors 이 consecutive5xxErrors 의 값 이상으로 설정된다면 consecutiveGatewayErrors 는 효과가 없습니다.
      • interval: 제외 분석 간격 (* 10s)
      • baseEjectionTime: Circuit open 유지 시간 (* 30s)
      • maxEjectionPercent: Load balancing pool 에서 제외될 수 있는 upstream service 비율 (* 10%)
      • minHealthPercent: Outlier detection이 활성화 되기 위한 Load balancing pool에서의 최소 healthy host 비율 (* 50%)
        • minHealthPercent 의 임계점보다 낮아지면 Outlier detection은 비활성화 되고, 남아 있는 Pod들을 대상으로 Load balancing 된다.
    • connectionPool : upstream service로 가는 connections의 volume을 정의. 더 많은 자세한 설명은 Envoy circuit breaker 참조.
      • http : http connection pool
        • http1MaxPendingRequests: Queue에서 connection pool에 연결을 기다리는 최대 request 수 - HTTP/1.1 (* 2^32-1)
        • http2MaxRequests: Backend로 가는 최대 요청 수 - HTTP/2 (* 2^32-1)
        • maxRequestsPerConnection: Connection 당 최대 요청 수. 값이 1이면 keep alive 기능이 지원되지 않습니다(disable). (* 0)
        • maxRetries: 주어진 시간 동안의 최대 재시도 수 (* 2^32-1)
        • idleTimeout: connection의 idle timeout. active request가 없는 동안의 시간. (* 1 hour)
        • h2UpgradePolicy: HTTP/1.1 connection을 HTTP/2로 업그레이드 해서 목적지로 보낼 지 결정
        • useClientProtocol: client protocol will be preserved while initiating connection to backend.
      • tcp: tcp connection pool
        • maxConnections: HTTP, TCP connection의 최대 값. (* 2^32-1)
        • connectionTimeout: TCP connection timeout (* 10s)
        • tcpKeepalive: 활성화 한 경우, TCP keepalive를 사용하기 위해 socket에 SO_KEEPALIVE 를 설정한다.
    • tls: SSL/TLS related settings for upstream connections. 자세한 설정 및 내용은 Envoy TLS context를 참조하시면 됩니다.
    • portLevelSettings: Traffic policies를 port 단위로 구체화 할 수 있는 옵션. port level setting은 destination level settings를 오버라이드합니다.
  • subsets: endpoints of services. A/B testing 같은 시나리오 또는 특정 버전의 서비스로 라우팅하는 등에서 활용될 수 있습니다. 또한, subset level에서 traffic policy를 따로 설정할 수 있는데, 기존 traffic policy를 오버라이드 해 적용됩니다.
    • name: subset의 이름. 서비스 이름과 서브셋 이름은 route rule에서 traffic이 뉘뉘어 질 때 사용됩니다.
    • labels: 해당 subset을 적용할 service filter label (map <k, v>)
    • trafficPolicy: 해당 subset에 적용할 traffic policy. 기존 정의된 traffic policy와 겹치는 부분이 있다면 override 합니다.
320x100
반응형
댓글
반응형
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함