5.3. 다중 기본 다중 네트워크 메시 설치
두 OpenShift Container Platform 클러스터의 다중 기본 다중 네트워크 토폴로지에 Istio를 설치합니다.
이 절차에서 CLUSTER1
은 동부 클러스터이며 CLUSTER2
는 서부 클러스터입니다.
두 개 이상의 클러스터에 걸쳐 메시에 대해 이러한 지침을 조정할 수 있습니다.
사전 요구 사항
- 메시를 구성하는 모든 클러스터에 OpenShift Service Mesh 3 Operator를 설치했습니다.
- "멀티 클러스터 메시의 인증서 생성"을 완료했습니다.
- "다중 클러스터 토폴로지에 인증서 적용"을 완료했습니다.
- Istio CNI(Container Network Interface) 리소스를 생성했습니다.
-
이러한 지침을 실행하는 데 사용할 수 있는 랩탑에
istioctl
이 설치되어 있습니다.
프로세스
다음 명령을 실행하여 설치할 Istio 버전을 정의하는
ISTIO_VERSION
환경 변수를 생성합니다.$ export ISTIO_VERSION=1.24.1
동부 클러스터에 Istio를 설치합니다.
다음 명령을 실행하여 동 클러스터에
Istio
리소스를 생성합니다.$ cat <<EOF | oc --context "${CTX_CLUSTER1}" apply -f - apiVersion: sailoperator.io/v1alpha1 kind: Istio metadata: name: default spec: version: v${ISTIO_VERSION} namespace: istio-system values: global: meshID: mesh1 multiCluster: clusterName: cluster1 network: network1 EOF
다음 명령을 실행하여 컨트롤 플레인에서
Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context "${CTX_CLUSTER1}" wait --for condition=Ready istio/default --timeout=3m
다음 명령을 실행하여 동 클러스터에 East-West 게이트웨이를 생성합니다.
$ oc --context "${CTX_CLUSTER1}" apply -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/east-west-gateway-net1.yaml
다음 명령을 실행하여 게이트웨이를 통해 서비스를 노출합니다.
$ oc --context "${CTX_CLUSTER1}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/expose-services.yaml
West 클러스터에 Istio를 설치합니다.
다음 명령을 실행하여 West 클러스터에서
Istio
리소스를 생성합니다.$ cat <<EOF | oc --context "${CTX_CLUSTER2}" apply -f - apiVersion: sailoperator.io/v1alpha1 kind: Istio metadata: name: default spec: version: v${ISTIO_VERSION} namespace: istio-system values: global: meshID: mesh1 multiCluster: clusterName: cluster2 network: network2 EOF
다음 명령을 실행하여 컨트롤 플레인에서
Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context "${CTX_CLUSTER2}" wait --for condition=Ready istio/default --timeout=3m
다음 명령을 실행하여 서부 클러스터에 East-West 게이트웨이를 만듭니다.
$ oc --context "${CTX_CLUSTER2}" apply -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/east-west-gateway-net2.yaml
다음 명령을 실행하여 게이트웨이를 통해 서비스를 노출합니다.
$ oc --context "${CTX_CLUSTER2}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/expose-services.yaml
다음 명령을 실행하여 서부 클러스터의 API 서버에 액세스할 수 있는 원격 시크릿을 동부 클러스터에 설치합니다.
$ istioctl create-remote-secret \ --context="${CTX_CLUSTER2}" \ --name=cluster2 | \ oc --context="${CTX_CLUSTER1}" apply -f -
다음 명령을 실행하여 동부 클러스터의 API 서버에 액세스할 수 있는 원격 시크릿을 웨스트 클러스터에 설치합니다.
$ istioctl create-remote-secret \ --context="${CTX_CLUSTER1}" \ --name=cluster1 | \ oc --context="${CTX_CLUSTER2}" apply -f -
5.3.1. 다중 클러스터 토폴로지 확인
샘플 애플리케이션을 배포하고 두 OpenShift Container Platform 클러스터의 다중 클러스터 토폴로지에서 트래픽을 확인합니다.
이 절차에서 CLUSTER1
은 동부 클러스터이며 CLUSTER2
는 서부 클러스터입니다.
사전 요구 사항
- 메시를 구성하는 모든 클러스터에 OpenShift Service Mesh Operator를 설치했습니다.
- "멀티 클러스터 메시의 인증서 생성"을 완료했습니다.
- "다중 클러스터 토폴로지에 인증서 적용"을 완료했습니다.
- Istio CNI(Container Network Interface) 리소스를 생성했습니다.
-
이러한 지침을 실행하는 데 사용할
istioctl
이 랩탑에 설치되어 있습니다. - 다중 클러스터 토폴로지가 설치되어 있습니다.
프로세스
동 클러스터에 샘플 애플리케이션을 배포합니다.
다음 명령을 실행하여 동 클러스터에 샘플 애플리케이션 네임스페이스를 생성합니다.
$ oc --context "${CTX_CLUSTER1}" get project sample || oc --context="${CTX_CLUSTER1}" new-project sample
다음 명령을 실행하여 사이드카 삽입을 지원하도록 애플리케이션 네임스페이스에 라벨을 지정합니다.
$ oc --context="${CTX_CLUSTER1}" label namespace sample istio-injection=enabled
helloworld
애플리케이션을 배포합니다.다음 명령을 실행하여
helloworld
서비스를 생성합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \ -l service=helloworld -n sample
다음 명령을 실행하여
helloworld-v1
배포를 생성합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \ -l version=v1 -n sample
다음 명령을 실행하여
절전
애플리케이션을 배포합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/sleep/sleep.yaml -n sample
다음 명령을 실행하여 동부 클러스터에서
helloworld
애플리케이션이Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context="${CTX_CLUSTER1}" wait --for condition=available -n sample deployment/helloworld-v1
다음 명령을 실행하여 East 클러스터에서
sleep
애플리케이션이Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context="${CTX_CLUSTER1}" wait --for condition=available -n sample deployment/sleep
West 클러스터에 샘플 애플리케이션을 배포합니다.
다음 명령을 실행하여 서부 클러스터에 샘플 애플리케이션 네임스페이스를 생성합니다.
$ oc --context "${CTX_CLUSTER2}" get project sample || oc --context="${CTX_CLUSTER2}" new-project sample
다음 명령을 실행하여 사이드카 삽입을 지원하도록 애플리케이션 네임스페이스에 라벨을 지정합니다.
$ oc --context="${CTX_CLUSTER2}" label namespace sample istio-injection=enabled
helloworld
애플리케이션을 배포합니다.다음 명령을 실행하여
helloworld
서비스를 생성합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \ -l service=helloworld -n sample
다음 명령을 실행하여
helloworld-v2
배포를 생성합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \ -l version=v2 -n sample
다음 명령을 실행하여
절전
애플리케이션을 배포합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/sleep/sleep.yaml -n sample
다음 명령을 실행하여 West 클러스터에서
helloworld
애플리케이션이Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context="${CTX_CLUSTER2}" wait --for condition=available -n sample deployment/helloworld-v2
다음 명령을 실행하여 West 클러스터에서
sleep
애플리케이션이Ready
상태 조건을 반환할 때까지 기다립니다.$ oc --context="${CTX_CLUSTER2}" wait --for condition=available -n sample deployment/sleep
클러스터 간 트래픽 흐름 확인
East 클러스터의 경우 다음 명령을 실행하여
helloworld
서비스에 10개의 요청을 보냅니다.$ for i in {0..9}; do \ oc --context="${CTX_CLUSTER1}" exec -n sample deploy/sleep -c sleep -- curl -sS helloworld.sample:5000/hello; \ done
두 클러스터의 응답이 표시되는지 확인합니다. 즉, 서비스 버전 1 및 버전 2는 응답에서 볼 수 있습니다.
West 클러스터의 경우
helloworld
서비스에 10개의 요청을 보냅니다.$ for i in {0..9}; do \ oc --context="${CTX_CLUSTER2}" exec -n sample deploy/sleep -c sleep -- curl -sS helloworld.sample:5000/hello; \ done
두 클러스터의 응답이 표시되는지 확인합니다. 즉, 서비스 버전 1 및 버전 2는 응답에서 볼 수 있습니다.
5.3.2. 개발 환경에서 다중 클러스터 토폴로지 제거
개발 환경에서 다중 클러스터 기능을 실험한 후 모든 클러스터에서 다중 클러스터 토폴로지를 제거합니다.
이 절차에서 CLUSTER1
은 동부 클러스터이며 CLUSTER2
는 서부 클러스터입니다.
사전 요구 사항
- 다중 클러스터 토폴로지가 설치되어 있습니다.
프로세스
다음 명령을 실행하여 개발 환경의 동 클러스터에서 Istio 및 샘플 애플리케이션을 제거합니다.
$ oc --context="${CTX_CLUSTER1}" delete istio/default ns/istio-system ns/sample ns/istio-cni
다음 명령을 실행하여 개발 환경의 서부 클러스터에서 Istio 및 샘플 애플리케이션을 제거합니다.
$ oc --context="${CTX_CLUSTER2}" delete istio/default ns/istio-system ns/sample ns/istio-cni