OpenShift Service Mesh 3.0 is a Technology Preview feature only
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. This documentation is a work in progress and might not be complete or fully tested.第3章 分散トレースと Service Mesh
3.1. サービスメッシュを使用した Red Hat OpenShift 分散トレーシングプラットフォームの設定
Red Hat OpenShift 分散トレーシングプラットフォームと Red Hat OpenShift Service Mesh の統合は、Red Hat OpenShift 分散トレーシングプラットフォーム (Tempo) と Red Hat OpenShift distributed tracing data collection の 2 つの部分で構成されます。
- Red Hat OpenShift distributed tracing platform (Tempo)
複雑な分散システム内のトランザクションを監視およびトラブルシューティングするための分散トレーシングを提供します。これはオープンソースの Grafana Tempo プロジェクトに基づいています。
分散トレーシングプラットフォーム (Tempo)、その機能、インストール、および設定の詳細は、Red Hat OpenShift 分散トレーシングプラットフォーム (Tempo) を参照してください。
- Red Hat OpenShift distributed tracing data collection
クラウドネイティブソフトウェア向けに、統一され、標準化された、ベンダー中立のテレメトリーデータ収集を提供することを目的としたオープンソースの OpenTelemetry プロジェクト に基づいています。Red Hat OpenShift distributed tracing data collection 製品は、OpenTelemetry Collector のデプロイおよび管理をサポートし、ワークロードの計装を簡素化します。
OpenTelemetry Collector は、テレメトリーデータを複数の形式で受信、処理、転送できるため、テレメトリー処理とテレメトリーシステム間の相互運用性にとって理想的なコンポーネントとなります。Collector は、メトリクス、トレース、ログを収集および処理するための統合ソリューションを提供します。
分散トレースデータ収集、その機能、インストール、および設定の詳細は、Red Hat OpenShift distributed tracing data collection を参照してください。
3.1.1. Service Mesh を使用した Red Hat OpenShift 分散トレーシングデータ収集の設定
Red Hat OpenShift Service Mesh を Red Hat OpenShift distributed tracing data collection と統合して、OpenTelemetry トレース、メトリクス、ログ計測、生成、収集、エクスポートし、ソフトウェアのパフォーマンスと動作を分析および理解できます。
前提条件
- Tempo Operator がインストールされている。Tempo Operator のインストール を参照してください。
- Red Hat OpenShift distributed tracing data collection Operator がインストールされている。Red Hat build of OpenTelemetry のインストール を参照してください。
-
TempoStack が
tempo
namespace にインストールされ、設定されている。TempoStack インスタンスのインストール を参照してください。 - Istio インスタンスが作成されている。
- Istio CNI インスタンスが作成されている。
手順
Red Hat OpenShift distributed tracing data collection Operator に移動し、
istio-system
namespace にOpenTelemetryCollector
リソースをインストールします。istio-system
namespace の OpenTelemetry Collector の例kind: OpenTelemetryCollector apiVersion: opentelemetry.io/v1beta1 metadata: name: otel namespace: istio-system spec: observability: metrics: {} deploymentUpdateStrategy: {} config: exporters: otlp: endpoint: 'tempo-sample-distributor.tempo.svc.cluster.local:4317' tls: insecure: true receivers: otlp: protocols: grpc: endpoint: '0.0.0.0:4317' http: {} service: pipelines: traces: exporters: - otlp receivers: - otlp
トレースを有効にするように Red Hat OpenShift Service Mesh を設定し、
meshConfig
で分散トレースデータ収集プロバイダーを定義します。トレースプロバイダーの有効化および定義の例
apiVersion: sailoperator.io/v1alpha1 kind: Istio metadata: # ... name: default spec: namespace: istio-system # ... values: meshConfig: enableTracing: true extensionProviders: - name: otel opentelemetry: port: 4317 service: otel-collector.istio-system.svc.cluster.local 1
- 1
service
フィールドは、istio-system
namespace のOpenTelemetry
コレクターサービスです。
Istio Telemetry リソースを作成し、
spec.values.meshConfig.ExtensionProviders
で定義されたトレーサーを有効にします。Istio Telemetry リソースの例
apiVersion: telemetry.istio.io/v1 kind: Telemetry metadata: name: otel-demo namespace: istio-system spec: tracing: - providers: - name: otel randomSamplingPercentage: 100
注記トレースが表示されることを確認したら、
randomSamplingPercentage
値を減らすか、default
に設定してリクエストの数を減らします。次のコマンドを実行して、
info
namespace を作成します。$ oc create ns info
使用している更新ストラテジーに応じて、適切なコマンドを実行して namespace でサイドカーインジェクションを有効にします。
InPlace
更新ストラテジーを使用している場合は、次のコマンドを実行します。$ oc label namespace curl istio-injection=enabled
RevisionBased
更新ストラテジーを使用している場合は、次のコマンドを実行します。次のコマンドを実行してリビジョン名を表示します。
$ oc get istiorevisions.sailoperator.io
出力例
NAME TYPE READY STATUS IN USE VERSION AGE default-v1-23-0 Local True Healthy True v1.23.0 3m33s
次のコマンドを実行して、namespace にリビジョン名のラベルを付け、サイドカーインジェクションを有効にします。
$ oc label namespace curl istio.io/rev=default-v1-23-0
次のコマンドを実行して、
bookinfo
namespace にinfo
アプリケーションをデプロイします。$ oc apply -f https://raw.githubusercontent.com/istio/istio/release-1.23/samples/info/platform/kube/bookinfo.yaml -n bookinfo
トレースを生成するために、
productpage
Pod へのトラフィックを生成します。$ oc exec -it -n info deployments/productpage-v1 -c istio-proxy -- curl localhost:9080/productpage
次のコマンドを実行してインテグレーションを検証し、UI でトレースを確認します。
$ oc get routes -n tempo tempo-sample-query-frontend
注記Jaeger UI の OpenShift ルートは、Tempo namespace に作成する必要があります。
tempo-sample-query-frontend
サービス用に手動で作成するか、.spec.template.queryFrontend.jaegerQuery.ingress.type: route
を使用してTempo
カスタムリソースを更新できます。