1.18.13.2. 장애 조치(failover)를 위해 DestinationRule 구성

다음을 구성하는 DestinationRule 리소스를 만듭니다.

  • 서비스에 대한 이상값 탐지입니다. 장애 조치가 제대로 작동하려면 이 작업이 필요합니다. 특히, 서비스 엔드포인트가 비정상인 시기를 확인하도록 사이드카 프록시를 구성하여 결국 다음 로컬에 장애 조치를 트리거합니다.
  • 리전 간 페일오버 정책. 이렇게 하면 영역 경계 이외의 장애 조치(failover)가 예측될 수 있습니다.This ensures that failover beyond a region boundary will behave predictably.

절차

  1. cluster-admin 역할의 사용자로 OpenShift Container Platform CLI에 로그인합니다. 다음 명령을 입력합니다. 메시지가 표시되면 사용자 이름과 암호를 입력합니다.

    $ oc login --username=<NAMEOFUSER> <API token> https://<HOSTNAME>:6443
  2. Service Mesh Control Plane을 설치한 프로젝트로 변경합니다.

    $ oc project <smcp-system>

    예를 들면 green-mesh-system 입니다.

    $ oc project green-mesh-system
  3. green-mesh가 사용할 수 없는 다음 예제를 기반으로 DestinationRule 파일을 만듭니다. 이 파일은 us-east 리전의 green-mesh에서 us-west 으로 트래픽을 라우팅해야 합니다.

    DestinationRule

    apiVersion: networking.istio.io/v1beta1
    kind: DestinationRule
    metadata:
      name: default-failover
      namespace: bookinfo
    spec:
      host: "ratings.bookinfo.svc.cluster.local"
      trafficPolicy:
        loadBalancer:
          localityLbSetting:
            enabled: true
            failover:
              - from: us-east
                to: us-west
        outlierDetection:
          consecutive5xxErrors: 3
          interval: 10s
          baseEjectionTime: 1m

  4. DestinationRule 을 배포합니다. 여기서 < DestinationRule >에는 파일의 전체 경로가 포함되어 다음 명령을 입력합니다.

    $ oc create -n <application namespace> -f <DestinationRule.yaml>

    예를 들면 다음과 같습니다.

    $ oc create -n bookinfo -f green-mesh-us-west-DestinationRule.yaml