Menu Close
1.7. バックエンドサービスを作成してそのサービスをサービスネットワーク上で利用可能にする手順
バックエンドサービスは east
namespace で実行され、デフォルトではサービスネットワークで利用できません。skupper
コマンドを使用して、サービスネットワークのすべての namespace にサービスを公開します。バックエンドアプリケーションは、メッセージをフロントエンドアプリケーションに渡す単純な Python アプリケーションです。
手順
バックエンドサービスを east 端末セッションにデプロイします。
$ oc create deployment hello-world-backend --image quay.io/skupper/hello-world-backend
サービスネットワーク上で、east 端末セッションからバックエンドサービスを公開します。
$ skupper expose deployment hello-world-backend --port 8080 --protocol tcp
west 端末セッションからサイトのステータスを確認します。
$ skupper status
出力は以下のようになります。
Skupper is enabled for namespace "west" in interior mode. It is connected to 1 other site. It has 1 exposed service.
サービスは
east
namespace から公開されます。west 端末セッションでフロントエンドルートを確認します。
ルートの詳細を取得します。
$ oc get routes
出力は以下のようになります。
NAME HOST/PORT hello-world-frontend <frontend-url>
ブラウザーで
<frontend-url>
の値に移動すると、以下のようなメッセージが表示されます。I am the frontend. The backend says 'Hello from hello-world-backend-78cd4d7d8c-plrr9 (1)'.
これは、フロントエンドが、別の OpenShift クラスターからサービスネットワーク上でバックエンドサービスを呼び出す方法を示しています。