5.4. 기본 원격 다중 네트워크 메시 설치
두 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를 설치합니다.
다음 명령을 실행하여 동 클러스터의 기본 네트워크를 설정합니다.
$ oc --context="${CTX_CLUSTER1}" label namespace istio-system topology.istio.io/network=network1
다음 명령을 실행하여 동 클러스터에
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 externalIstiod: true 1 EOF
- 1
- 이를 통해 동 클러스터에 컨트롤 플레인이 설치되어 다른 원격 클러스터의 외부 컨트롤 플레인 역할을 할 수 있습니다.
다음 명령을 실행하여 컨트롤 플레인에서 "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
다음 명령을 실행하여 West 클러스터의 서비스가 컨트롤 플레인에 액세스할 수 있도록 게이트웨이를 통해 컨트롤 플레인을 노출합니다.
$ oc --context "${CTX_CLUSTER1}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/expose-istiod.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를 설치합니다.
다음 명령을 실행하여 동 클러스터에서 실행 중인 East-West 게이트웨이의 IP 주소를 저장합니다.
$ export DISCOVERY_ADDRESS=$(oc --context="${CTX_CLUSTER1}" \ -n istio-system get svc istio-eastwestgateway \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
다음 명령을 실행하여 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 profile: remote values: istiodRemote: injectionPath: /inject/cluster/cluster2/net/network2 global: remotePilotAddress: ${DISCOVERY_ADDRESS} EOF
다음 명령을 실행하여 동 클러스터의 컨트롤 플레인에서 관리하도록 West 클러스터의
istio-system
네임스페이스에 주석을 답니다.$ oc --context="${CTX_CLUSTER2}" annotate namespace istio-system topology.istio.io/controlPlaneClusters=cluster1
다음 명령을 실행하여 West 클러스터의 기본 네트워크를 설정합니다.
$ oc --context="${CTX_CLUSTER2}" label namespace istio-system topology.istio.io/network=network2
다음 명령을 실행하여 서부 클러스터의 API 서버에 액세스할 수 있는 원격 시크릿을 동부 클러스터에 설치합니다.
$ istioctl create-remote-secret \ --context="${CTX_CLUSTER2}" \ --name=cluster2 | \ oc --context="${CTX_CLUSTER1}" apply -f -
다음 명령을 실행하여
Istio
리소스가 "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
참고West 클러스터는 원격 프로필과 함께 설치되므로 East 클러스터에서 애플리케이션 서비스를 노출하면 두 클러스터의 동부 게이트웨이에 노출됩니다.