VirtualService

kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: a-set-of-routing-rules-we-can-call-this-anything  # VS 명
  namespace: default
spec:
  hosts:
	  # 쿠버네티스에 등록된 서비스 DNS 호스트
    - fleetman-staff-service.default.svc.cluster.local
  http:
    - route:
        - destination:
		         # 라우팅할 대상 서비스 DNS 1
            host: fleetman-staff-service.default.svc.cluster.local
            # 사용할 DR 서브셋 명
            subset: safe-group
          weight: 90
        - destination:
		        # 라우팅할 대상 서비스 DNS 2
            host: fleetman-staff-service.default.svc.cluster.local
            # 사용할 DR 서브셋 명
            subset: risky-group
          weight: 10
      # 요렇게 uri 매칭도 할 수 있다.
      # match:
      #  - uri:
      #      prefix: "/v1"

라우팅 규칙

트래픽 분산

Retry, Timeout 정책

헤더 변조

쿠버네티스 서비스와의 차이

DestinationRule

kind: DestinationRule
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: grouping-rules-for-our-photograph-canary-release # DR 명
  namespace: default
spec:
  host: fleetman-staff-service # Service
  subsets:
	  # Label selector로 동작
    - labels:
        version: safe
      name: safe-group
    - labels:
        version: risky
      name: risky-group
  # 요런 식으로 요청에 대한 정책을 지정할 수 있다.
  trafficPolicy:
    loadBalancer:
      simple: ROUND_ROBIN
    connectionPool:
      http:
        maxRequestsPerConnection: 1
    outlierDetection:
      consecutiveErrors: 5
      interval: 1m # 연속 오류 탐지 interval
      baseEjectionTime: 30s # 인스턴스를 트래픽에서 제외시키는 시간
      maxEjectionPercent: 50 # 트래픽 분배를 제외하는 인스턴스 비율

서킷 브레이커

로드 밸런싱