This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.1.18.12. 페더레이션 메시로 서비스 가져오기
서비스를 가져오면 서비스 메시 내에서 다른 메시에서 내보낸 서비스를 명시적으로 지정할 수 있습니다.
ImportedServiceSet
리소스를 사용하여 가져올 서비스를 선택합니다. 메시 피어에서 내보내고 명시적으로 가져온 서비스만 메시에서 사용할 수 있습니다. 명시적으로 가져오지 않은 서비스는 메시 내에서 사용할 수 없습니다.
- 네임스페이스 또는 이름으로 서비스를 선택할 수 있습니다.
- 예를 들어 와일드카드를 사용하여 서비스를 선택하면 네임스페이스로 내보낸 모든 서비스를 가져올 수 있습니다.
- 레이블 선택기를 사용하여 내보내기 서비스를 선택할 수 있으며, 이는 메시에 전역이거나 특정 멤버 네임스페이스로 범위가 지정될 수 있습니다.
-
별칭을 사용하여 서비스를 가져올 수 있습니다. 예를 들어
custom-ns/bar
서비스를other-mesh/bar
로 가져올 수 있습니다. -
정규화된 도메인 이름에 대해 가져온 서비스의
name.namespace
에 추가할 사용자 지정 도메인 접미사를 지정할 수 있습니다(예:bar.other-mesh.imported.local
).
다음 예제는 red-mesh
에서 내보낸 서비스를 가져오는 green-mesh
에 대한 예입니다.
ImportServiceSet의 예
매개변수 | 설명 | 값 |
---|---|---|
metadata: name:
| 서비스를 페더레이션 메시로 내보낸 ServiceMeshRegistryLogin의 이름입니다. | |
metadata: namespace:
| ServiceMeshRegistryLogin 리소스를 포함하는 네임스페이스 이름( 메시 시스템 네임스페이스)입니다. | |
spec: importRules: - type:
| 서비스에 대한 가져오기를 관리할 규칙 유형입니다. 서비스에 대한 첫 번째 일치 규칙이 가져오기에 사용됩니다. |
|
|
| |
spec: importRules: - type: NameSelector importAsLocal:
|
로컬 서비스를 사용하여 원격 엔드포인트를 집계하려면 |
|
|
서비스에 대한 별칭을 사용하는 |
red-mesh에서 blue-mesh로 "bookinfo/ratings" 서비스를 가져옵니다.
빨간색-mesh의 west-data-center 네임스페이스에서 모든 서비스를 green-mesh로 가져옵니다. 이러한 서비스는 <name>.west-data-center.svc.red-mesh-imports.local로 액세스할 수 있습니다.
1.18.12.1. ImportedServiceSet 생성 링크 복사링크가 클립보드에 복사되었습니다!
ImportServiceSet
리소스를 생성하여 메시로 가져올 서비스를 명시적으로 선언합니다.
서비스는 "hidden" 서비스인 .svc.<ServiceMeshTiB.name>.remote 를 사용하여 가져올 수 있으며 송신 게이트웨이 네임스페이스 내에서만 표시되고 내보낸 서비스의 호스트 이름과 <exported-name> <exported-namespace>
연결됩니다. 이 서비스는 . .<domainSuffix > . . . 여기서 domainSuffix
는 svc.<ServiceMeshdpdk.name>-imports.local
로 <export-name> <export-namespace>
로컬로 사용할 수 있습니다. 기본적으로 importAsLocal
가 true
로 설정되어 있지 않는 한 domainSuffix
는 svc.cluster.local
입니다. importAsLocal
가 false
로 설정된 경우 가져오기 규칙의 도메인 접미사가 적용됩니다. 로컬 가져오기를 메시의 다른 서비스와 마찬가지로 처리할 수 있습니다. 송신 게이트웨이를 통해 자동으로 라우팅되며, 여기서 내보낸 서비스의 원격 이름으로 리디렉션됩니다.
사전 요구 사항
-
메시 페더레이션을 위해 클러스터 및
ServiceMeshControlPlane
이 구성되어 있습니다. -
cluster-admin
역할이 있는 계정.
아직 내보내지 않은 경우에도 가져오기를 위해 서비스를 구성할 수 있습니다. ImportServiceSet에 지정된 값과 일치하는 서비스를 배포하고 내보내면 자동으로 가져옵니다.
CLI의 절차
다음 절차에 따라 명령줄에서 ImportServiceSet
을 만듭니다.
cluster-admin
역할의 사용자로 OpenShift Container Platform CLI에 로그인합니다. 다음 명령을 입력합니다. 메시지가 표시되면 사용자 이름과 암호를 입력합니다.oc login --username=<NAMEOFUSER> <API token> https://<HOSTNAME>:6443
$ oc login --username=<NAMEOFUSER> <API token> https://<HOSTNAME>:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 컨트롤 플레인을 설치한 프로젝트로 변경합니다(예:
green-mesh-system
).oc project green-mesh-system
$ oc project green-mesh-system
Copy to Clipboard Copied! Toggle word wrap Toggle overflow green-mesh
가 이전에red-mesh
에서 내보낸 서비스를 가져오는 다음 예제에 따라ImportServiceSet
파일을 만듭니다.ImportServiceSet 리소스 예 red-mesh에서 green-mesh로
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 다음 명령을 실행하여 green-mesh-system 네임스페이스에
ImportServiceSet
리소스를 업로드하고 만듭니다.oc create -n <ControlPlaneNamespace> -f <ImportServiceSet.yaml>
$ oc create -n <ControlPlaneNamespace> -f <ImportServiceSet.yaml>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 예를 들면 다음과 같습니다.
oc create -n green-mesh-system -f import-from-red-mesh.yaml
$ oc create -n green-mesh-system -f import-from-red-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
페더레이션 메시의 각 메시 피어에 필요에 따라
ImportServiceSets
를 추가로 생성합니다. green-mesh
으로 가져온 서비스를 확인하려면 다음 명령을 실행합니다.oc get importedserviceset <PeerMeshImportedInto> -o yaml
$ oc get importedserviceset <PeerMeshImportedInto> -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 예를 들면 다음과 같습니다.
oc get importedserviceset green-mesh -o yaml
$ oc get importedserviceset green-mesh -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 다음 명령을 실행하여 메시로 가져온 서비스를 확인합니다.
oc get importedserviceset <PeerMeshImportedInto> -o yaml
$ oc get importedserviceset <PeerMeshImportedInto> -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 빨간색 메시에서 내보낸 서비스를
'green-mesh-system 네임 스페이스에서 importedserviceset/red-mesh' 오브젝트의
status 섹션을 사용하여 녹색 메시로 가져왔는 검증의 예:oc -n green-mesh-system get importedserviceset/red-mesh -o yaml
$ oc -n green-mesh-system get importedserviceset/red-mesh -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow 앞의 예에서
localService
아래의 채운 필드에 표시된 대로 ratings 서비스만 가져옵니다. reviews 서비스는 가져오기에 사용할 수 있지만ImportedServiceSet
오브젝트의importRules
와 일치하지 않기 때문에 현재 가져오지는 않습니다.