LoginSignup
4
2

More than 1 year has passed since last update.

OpenShift Service Meshを使ってみた!

Last updated at Posted at 2021-07-16

背景

元々の目的はユーザー定義プロジェクトのモニタリングを使うことではなく、Argo RolloutsでProgressive Deliveryを実施する際のトラフィックコントロールにOpenShift Service Meshを使うユースケースを試したかったのが発端です。

この記事ではOpenShift Service MeshをOpenShift v4.6に導入してBookinfoアプリケーションの稼働を確認するまでの手順を記載しています。

手順

Red Hat OpenShift Service Mesh のインストール

以下のマニュアルを参考にRed Hat OpenShift Service Mesh をインストールします。

OpenShift Elasticsearch Operatorの導入

  • 以下のOperatorをインストール
    image.png

  • installをクリック
    image.png

  • デフォルトの設定のままinstall
    image.png

  • 完了して以下の画面が表示されるまで待機
    image.png

OpenShift Jaeger Operatorのインストール

  • 以下のOperatorをインストール
    image.png

  • installをクリック
    image.png

  • デフォルトの設定のままinstall
    image.png

  • 完了して以下の画面が表示されるまで待機
    image.png

Kiali Operatorのインストール

  • 以下のOperatorをインストール
    image.png

  • installをクリック
    image.png

  • デフォルトの設定のままinstall
    image.png

  • 完了して以下の画面が表示されるまで待機
    image.png

Red Hat OpenShift Service Mesh Operatorのインストール

  • 以下のOperatorをインストール
    image.png

  • installをクリック
    image.png

  • デフォルトの設定のままinstall
    image.png

  • 完了して以下の画面が表示されるまで待機
    image.png

  • 左メニューのInstalled OperatorsよりすべてのOperatorがインストールされていることを確認
    image.png

ServiceMeshControlPlaneの作成

  • istio-systemプロジェクトを作成
    image.png

  • 作成されたことを確認
    image.png

  • 左メニューのInstalled OperatorsよりRed Hat OpenShift Service Mesh を選択
    image.png

  • Istion Service Mesh Control Planeタブを選択して、Create ServiceMeshControlPlaneをクリック
    image.png

  • デフォルト設定のままCreateをクリック
    image.png

  • ServiceMeshControlPlaneが作成されたことを確認
    image.png

  • Resources タブをクリックして、Red Hat OpenShift Service Mesh コントロールプレーンリソース (Operator が作成し、設定したもの) を確認
    image.png

サービスメッシュへのサービスの追加

  • サービスメッシュに参加させたいプロジェクトを作成
    image.png

  • 左メニューのInstalled Operatorsを選択し、プロジェクトでistio-systemを選択した上で、Red Hat OpenShift Service Meshを選択
    image.png

  • Istio Service Mesh Member Rollタブを選択し、Create ServiceMeshMemberRollをクリック
    image.png

  • Membersを展開して、Valueにサービスメッシュに参加させたいプロジェクトを設定し、Createをクリック
    image.png

  • ServiceMeshMemberRollが作成されたことを確認
    image.png

Bookinfo のサンプルアプリケーションのデプロイ

  • 以下のコマンドを実行し、サービスメッシュに参加させたプロジェクトにBookinfoサンプルアプリケーションをデプロイ
PS D:\git> oc apply -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/platform/kube/bookinfo.yaml
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
PS D:\git>
  • Ingressゲートウェイの作成
PS D:\git> oc apply -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/networking/bookinfo-gateway.yaml
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
PS D:\git>
  • デフォルトの宛先ルールの追加
PS D:\git> oc apply -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.0/samples/bookinfo/networking/destination-rule-all.yaml
destinationrule.networking.istio.io/productpage created
destinationrule.networking.istio.io/reviews created
destinationrule.networking.istio.io/ratings created
destinationrule.networking.istio.io/details created
PS D:\git>

稼働確認

  • istio-systemのRouteを取得
PS D:\git> oc get route -n istio-system
NAME                   HOST/PORT                                                                                                                     PATH   SERVICES               PORT    TERMINATION          WILDCARD
grafana                grafana-istio-system.dte-ocp46-8uvivd-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud                       grafana                <all>   reencrypt/Redirect   None
istio-ingressgateway   istio-ingressgateway-istio-system.dte-ocp46-8uvivd-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud          istio-ingressgateway   8080                         None
jaeger                 jaeger-istio-system.dte-ocp46-8uvivd-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud                        jaeger-query           <all>   reencrypt            None
kiali                  kiali-istio-system.dte-ocp46-8uvivd-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud                         kiali                  <all>   reencrypt/Redirect   None
prometheus             prometheus-istio-system.dte-ocp46-8uvivd-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud                    prometheus             <all>   reencrypt/Redirect   None
PS D:\git>
  • ブラウザから以下のアドレスにアクセスする
    • http://取得したistio-ingressgatewayのHOST/PORT/productpage

image.png
Bookinfoの画面が表示されればOK
なお、前日のistio-systemの各RouteからGrafana、Jaeger、Kiali、Prometheusの各UIにアクセスできる。

KialiのコンソールにアクセスすることでBookinfoの各サービスのルーティング情報がよくわかる。
image.png

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2