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.11. 연결된 메시에서 서비스 내보내기
서비스를 내보내면 메시는 해당 서비스 중 하나 이상을 연합된 메시의 다른 멤버와 공유할 수 있습니다.
Exported ServiceSet
리소스를 사용하여 연결된 메시의 다른 피어에 사용할 수 있는 메시의 서비스를 선언합니다. 피어와 공유할 각 서비스를 명시적으로 선언해야 합니다.
- 네임스페이스 또는 이름으로 서비스를 선택할 수 있습니다.
- 와일드카드를 사용하여 서비스를 선택할 수 있습니다(예: 네임스페이스의 모든 서비스를 내보내려면).
-
별칭을 사용하여 서비스를 내보낼 수 있습니다. 예를 들어
foo/bar 서비스를
로 내보낼 수 있습니다.custom-ns/bar
-
메시의 시스템 네임스페이스에 표시되는 서비스만 내보낼 수 있습니다. 예를 들어
networking.istio.io/exportTo 레이블이 '.
'로 설정된 다른 네임스페이스의 서비스는 내보내기 후보가 아닙니다. - 내보낸 서비스의 경우 대상 서비스는 원래 요청자가 아닌 수신 게이트웨이의 트래픽만 확인합니다. 즉, 다른 메시의 송신 게이트웨이 또는 요청을 시작하는 워크로드의 클라이언트 ID를 볼 수 없습니다.
다음 예제는 red-mesh가 green-mesh
로 내보내고 있는 서비스를 위한 예입니다 .
ExportedServiceSet 리소스의 예
매개변수 | 설명 | 값 |
---|---|---|
metadata: name:
| 이 서비스를 노출하는 ServiceMeshPeer의 이름입니다. |
|
metadata: namespace:
| 이 리소스를 포함하는 프로젝트/네임스페이스 이름(메서드의 시스템 네임스페이스여야 함)입니다. | |
spec: exportRules: - type:
| 이 서비스의 내보내기를 제어하는 규칙 유형입니다. 서비스에 대해 첫 번째로 일치하는 규칙이 내보내기에 사용됩니다. |
|
|
| |
|
서비스에 대한 별칭을 사용하는 | |
|
| |
|
서비스에 별칭을 사용하는 |
이름이 "ratings"인 서비스를 red-mesh의 모든 네임스페이스에서 blue-mesh로 내보냅니다.
west-data-center 네임스페이스에서 green-mesh로 모든 서비스 내보내기
1.18.11.1. ExportedServiceSet 생성 링크 복사링크가 클립보드에 복사되었습니다!
Exported ServiceSet
리소스를 생성하여 메시 피어에서 사용할 수 있는 서비스를 명시적으로 선언합니다.
서비스는 <export-name>.<export-namespace>.svc.<ServiceMeshPeer.name>-exports.local
로 내보내지며 대상 서비스로 자동으로 라우팅됩니다. 내보내기 메시에서 내보낸 서비스를 알려진 이름입니다. 수신 게이트웨이가 이 이름으로 향하는 요청을 수신하면 내보낼 실제 서비스로 라우팅됩니다. 예를 들어 ratings.red-mesh-bookinfo
라는 서비스가 green-mesh
에 ratings.bookinfo
로 내보내지는 경우 서비스는 grades .bookinfo.svc.svc.green-mesh-exports.local
로 내보내고 해당 호스트 이름의 수신 게이트웨이에서 수신하는 트래픽이 ratings.red-mesh-bookinfo
서비스로 라우팅됩니다.
사전 요구 사항
-
클러스터 및
ServiceMeshControlPlane
은 메시 페더레이션을 위해 구성되었습니다. -
cluster-admin
역할이 있는 계정.
아직 없는 경우에도 내보내기용 서비스를 구성할 수 있습니다. ExportedServiceSet에 지정된 값과 일치하는 서비스가 배포되면 자동으로 내보냅니다.
CLI의 프로세스
다음 절차에 따라 명령줄에서 ExportedServiceSet
을 만듭니다.
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 Service Mesh Control Plane을 설치한 프로젝트(예:
red-mesh-system
)로 변경합니다.oc project red-mesh-system
$ oc project red-mesh-system
Copy to Clipboard Copied! Toggle word wrap Toggle overflow red-mesh
가 서비스를green-mesh
로 내보내는 다음 예제를 기반으로ExportedServiceSet
파일을 만듭니다.red-mesh에서 green-mesh로 ExportedServiceSet 리소스의 예
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 다음 명령을 실행하여 red-mesh-system 네임스페이스에
ExportedServiceSet
리소스를 업로드하고 만듭니다.oc create -n <ControlPlaneNamespace> -f <ExportedServiceSet.yaml>
$ oc create -n <ControlPlaneNamespace> -f <ExportedServiceSet.yaml>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 예를 들면 다음과 같습니다.
oc create -n red-mesh-system -f export-to-green-mesh.yaml
$ oc create -n red-mesh-system -f export-to-green-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
페더레이션 메시의 각 메시 피어에 필요한 추가
ExportedServiceSets
를 만듭니다. red-mesh에서 내보낸 서비스를 검증하여 green-mesh
와 공유하려면 다음 명령을실행합니다
.oc get exportedserviceset <PeerMeshExportedTo> -o yaml
$ oc get exportedserviceset <PeerMeshExportedTo> -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 예를 들면 다음과 같습니다.
oc get exportedserviceset green-mesh -o yaml
$ oc get exportedserviceset green-mesh -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 다음 명령을 실행하여 red-mesh 내보내기를 사용하여 green-mesh와 공유할 서비스를 확인합니다.
oc get exportedserviceset <PeerMeshExportedTo> -o yaml
$ oc get exportedserviceset <PeerMeshExportedTo> -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 예를 들면 다음과 같습니다.
oc -n red-mesh-system get exportedserviceset green-mesh -o yaml
$ oc -n red-mesh-system get exportedserviceset green-mesh -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 녹색 메시와 공유되는 빨간색 메시에서 내보낸 서비스의 유효성 검사 예.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow status.exportedServices
배열에는 현재 내보낸 서비스가 나열됩니다(이러한 서비스는 ExportedServiceSet 오브젝트의 내보내기
규칙과 일치함). 배열의 각 항목은 내보낸 서비스의 이름과 내보낸 로컬 서비스에 대한 세부 정보를 나타냅니다.내보낼 것으로 예상되는 서비스가 누락된 경우 Service 오브젝트가 있는지 확인하고 이름 또는 레이블이 Exported
ServiceSet
오브젝트에 정의된exportRules
와 일치하고 Service 오브젝트의 네임스페이스가ServiceMeshMemberRoll
또는ServiceMeshMember
오브젝트를 사용하여 서비스 메시의 멤버로 구성되어 있는지 확인합니다.