6.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.3동부 클러스터에 Istio를 설치합니다.
다음 명령을 실행하여 동 클러스터에
Istio리소스를 생성합니다.$ cat <<EOF | oc --context "${CTX_CLUSTER1}" apply -f - apiVersion: sailoperator.io/v1 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/deployment-models/resources/east-west-gateway-net1.yaml다음 명령을 실행하여 게이트웨이를 통해 서비스를 노출합니다.
$ oc --context "${CTX_CLUSTER1}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/deployment-models/resources/expose-services.yaml
West 클러스터에 Istio를 설치합니다.
다음 명령을 실행하여 West 클러스터에서
Istio리소스를 생성합니다.$ cat <<EOF | oc --context "${CTX_CLUSTER2}" apply -f - apiVersion: sailoperator.io/v1 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/deployment-models/resources/east-west-gateway-net2.yaml다음 명령을 실행하여 게이트웨이를 통해 서비스를 노출합니다.
$ oc --context "${CTX_CLUSTER2}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/deployment-models/resources/expose-services.yaml
다음 명령을 실행하여 동 클러스터에 대한
istio-reader-service-account서비스 계정을 생성합니다.$ oc --context="${CTX_CLUSTER1}" create serviceaccount istio-reader-service-account -n istio-system다음 명령을 실행하여 West 클러스터의
istio-reader-service-account서비스 계정을 생성합니다.$ oc --context="${CTX_CLUSTER2}" create serviceaccount istio-reader-service-account -n istio-system다음 명령을 실행하여
cluster-reader역할을 East 클러스터에 추가합니다.$ oc --context="${CTX_CLUSTER1}" adm policy add-cluster-role-to-user cluster-reader -z istio-reader-service-account -n istio-system다음 명령을 실행하여 West 클러스터에
cluster-reader역할을 추가합니다.$ oc --context="${CTX_CLUSTER2}" adm policy add-cluster-role-to-user cluster-reader -z istio-reader-service-account -n istio-system다음 명령을 실행하여 서부 클러스터의 API 서버에 액세스할 수 있는 원격 시크릿을 동부 클러스터에 설치합니다.
$ istioctl create-remote-secret \ --context="${CTX_CLUSTER2}" \ --name=cluster2 \ --create-service-account=false | \ oc --context="${CTX_CLUSTER1}" apply -f -다음 명령을 실행하여 동부 클러스터의 API 서버에 액세스할 수 있는 원격 시크릿을 웨스트 클러스터에 설치합니다.
$ istioctl create-remote-secret \ --context="${CTX_CLUSTER1}" \ --name=cluster1 \ --create-service-account=false | \ oc --context="${CTX_CLUSTER2}" apply -f -
6.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=enabledhelloworld애플리케이션을 배포합니다.다음 명령을 실행하여
helloworld서비스를 생성합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/helloworld/helloworld.yaml \ -l service=helloworld -n sample다음 명령을 실행하여
helloworld-v1배포를 생성합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/helloworld/helloworld.yaml \ -l version=v1 -n sample
다음 명령을 실행하여
절전애플리케이션을 배포합니다.$ oc --context="${CTX_CLUSTER1}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/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=enabledhelloworld애플리케이션을 배포합니다.다음 명령을 실행하여
helloworld서비스를 생성합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/helloworld/helloworld.yaml \ -l service=helloworld -n sample다음 명령을 실행하여
helloworld-v2배포를 생성합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/helloworld/helloworld.yaml \ -l version=v2 -n sample
다음 명령을 실행하여
절전애플리케이션을 배포합니다.$ oc --context="${CTX_CLUSTER2}" apply \ -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/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는 응답에서 볼 수 있습니다.
6.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