5.3. マルチプライマリーマルチネットワークメッシュのインストール


2 つの OpenShift Container Platform クラスターのマルチプライマリーマルチネットワークトポロジーに Istio をインストールします。

注記

この手順では、CLUSTER1 は East クラスター、CLUSTER2 は West クラスターです。

これらの手順は、2 つ以上のクラスターにまたがるメッシュに適応できます。

前提条件

  • メッシュに含まれるすべてのクラスターに OpenShift Service Mesh 3 Operator をインストールしている。
  • 「マルチクラスターメッシュの証明書の作成」を完了している。
  • 「ルチクラスタートポロジーへの証明書の適用」を完了している。
  • Istio Container Network Interface (CNI) リソースを作成している。
  • これらの手順を実行するために使用できるノートパソコンに istioctl がインストールされている。

手順

  1. 以下のコマンドを実行して、インストールする Istio バージョンを定義する ISTIO_VERSION 環境変数を作成します。

    $ export ISTIO_VERSION=1.24.1
  2. Istio を East クラスターにインストールします。

    1. 次のコマンドを実行して、East クラスターに 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
      EOF
    2. 次のコマンドを実行して、コントロールプレーンが Ready ステータス状態を返すまで待機します。

      $ oc --context "${CTX_CLUSTER1}" wait --for condition=Ready istio/default --timeout=3m
    3. 次のコマンドを実行して、East クラスターに East-West ゲートウェイを作成します。

      $ oc --context "${CTX_CLUSTER1}" apply -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/east-west-gateway-net1.yaml
    4. 次のコマンドを実行して、ゲートウェイを介してサービスを公開します。

      $ oc --context "${CTX_CLUSTER1}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/expose-services.yaml
  3. Istio を West クラスターにインストールします。

    1. 次のコマンドを実行して、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
        values:
          global:
            meshID: mesh1
            multiCluster:
              clusterName: cluster2
            network: network2
      EOF
    2. 次のコマンドを実行して、コントロールプレーンが Ready ステータス状態を返すまで待機します。

      $ oc --context "${CTX_CLUSTER2}" wait --for condition=Ready istio/default --timeout=3m
    3. 次のコマンドを実行して、West クラスターに East-West ゲートウェイを作成します。

      $ oc --context "${CTX_CLUSTER2}" apply -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/east-west-gateway-net2.yaml
    4. 次のコマンドを実行して、ゲートウェイを介してサービスを公開します。

      $ oc --context "${CTX_CLUSTER2}" apply -n istio-system -f https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/docs/multicluster/expose-services.yaml
  4. 次のコマンドを実行して、West クラスターの API サーバーへのアクセスを提供する East クラスターにリモートシークレットをインストールします。

    $ istioctl create-remote-secret \
      --context="${CTX_CLUSTER2}" \
      --name=cluster2 | \
      oc --context="${CTX_CLUSTER1}" apply -f -
  5. 次のコマンドを実行して、East クラスターの API サーバーへのアクセスを提供する West クラスターにリモートシークレットをインストールします。

    $ istioctl create-remote-secret \
      --context="${CTX_CLUSTER1}" \
      --name=cluster1 | \
      oc --context="${CTX_CLUSTER2}" apply -f -

5.3.1. マルチクラスタートポロジーの確認

サンプルアプリケーションをデプロイし、2 つの OpenShift Container Platform クラスターのマルチクラスタートポロジーでトラフィックを確認します。

注記

この手順では、CLUSTER1 は East クラスター、CLUSTER2 は West クラスターです。

前提条件

  • メッシュに含まれるすべてのクラスターに OpenShift Service Mesh Operator をインストールしている。
  • 「マルチクラスターメッシュの証明書の作成」を完了している。
  • 「ルチクラスタートポロジーへの証明書の適用」を完了している。
  • Istio Container Network Interface (CNI) リソースを作成している。
  • これらの手順を実行するために使用するノートパソコンに istioctl がインストールされている。
  • マルチクラスタートポロジーがインストールされている。

手順

  1. East クラスターにサンプルアプリケーションをデプロイします。

    1. 次のコマンドを実行して、East クラスター上にサンプルアプリケーション namespace を作成します。

      $ oc --context "${CTX_CLUSTER1}" get project sample || oc --context="${CTX_CLUSTER1}" new-project sample
    2. 以下のコマンドを実行して、サイドカーインジェクションをサポートするようにアプリケーション namespace にラベルを付けます。

      $ oc --context="${CTX_CLUSTER1}" label namespace sample istio-injection=enabled
    3. helloworld アプリケーションをデプロイします。

      1. 以下のコマンドを実行して helloworld サービスを作成します。

        $ oc --context="${CTX_CLUSTER1}" apply \
          -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \
          -l service=helloworld -n sample
      2. 以下のコマンドを実行して helloworld-v1 デプロイメントを作成します。

        $ oc --context="${CTX_CLUSTER1}" apply \
          -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \
          -l version=v1 -n sample
    4. 次のコマンドを実行して、sleep アプリケーションをデプロイします。

      $ oc --context="${CTX_CLUSTER1}" apply \
        -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/sleep/sleep.yaml -n sample
    5. 次のコマンドを実行して、East クラスターの helloworld アプリケーションが Ready ステータス状態を返すまで待機します。

      $ oc --context="${CTX_CLUSTER1}" wait --for condition=available -n sample deployment/helloworld-v1
    6. 次のコマンドを実行して、East クラスターの sleep アプリケーションが Ready ステータス状態を返すまで待機します。

      $ oc --context="${CTX_CLUSTER1}" wait --for condition=available -n sample deployment/sleep
  2. West クラスターにサンプルアプリケーションをデプロイします。

    1. 次のコマンドを実行して、West クラスターにサンプルアプリケーション namespace を作成します。

      $ oc --context "${CTX_CLUSTER2}" get project sample || oc --context="${CTX_CLUSTER2}" new-project sample
    2. 以下のコマンドを実行して、サイドカーインジェクションをサポートするようにアプリケーション namespace にラベルを付けます。

      $ oc --context="${CTX_CLUSTER2}" label namespace sample istio-injection=enabled
    3. helloworld アプリケーションをデプロイします。

      1. 以下のコマンドを実行して helloworld サービスを作成します。

        $ oc --context="${CTX_CLUSTER2}" apply \
          -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \
          -l service=helloworld -n sample
      2. 以下のコマンドを実行して、helloworld-v2 デプロイメントを作成します。

        $ oc --context="${CTX_CLUSTER2}" apply \
          -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/helloworld/helloworld.yaml \
          -l version=v2 -n sample
    4. 次のコマンドを実行して、sleep アプリケーションをデプロイします。

      $ oc --context="${CTX_CLUSTER2}" apply \
        -f https://raw.githubusercontent.com/istio/istio/${ISTIO_VERSION}/samples/sleep/sleep.yaml -n sample
    5. 次のコマンドを実行して、West クラスターの helloworld アプリケーションが Ready ステータス状態を返すまで待機します。

      $ oc --context="${CTX_CLUSTER2}" wait --for condition=available -n sample deployment/helloworld-v2
    6. 次のコマンドを実行して、West クラスターの sleep アプリケーションが Ready ステータス状態を返すまで待機します。

      $ oc --context="${CTX_CLUSTER2}" wait --for condition=available -n sample deployment/sleep

クラスター間のトラフィックフローの確認

  1. 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 が応答で確認できます。

  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 が応答で確認できます。

5.3.2. 開発環境からのマルチクラスタートポロジーの削除

開発環境でマルチクラスター機能を試した後、すべてのクラスターからマルチクラスタートポロジーを削除します。

注記

この手順では、CLUSTER1 は East クラスター、CLUSTER2 は West クラスターです。

前提条件

  • マルチクラスタートポロジーがインストールされている。

手順

  1. 次のコマンドを実行して、Istio とサンプルアプリケーションを開発環境の East クラスターから削除します。

    $ oc --context="${CTX_CLUSTER1}" delete istio/default ns/istio-system ns/sample ns/istio-cni
  2. 次のコマンドを実行して、Istio とサンプルアプリケーションを開発環境の West クラスターから削除します。

    $ oc --context="${CTX_CLUSTER2}" delete istio/default ns/istio-system ns/sample ns/istio-cni
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.