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.第2章 メトリクスと Service Mesh
2.1. メトリクスの使用
モニタリングスタックコンポーネントは、すべての OpenShift Container Platform インストールにデフォルトでデプロイされ、Cluster Monitoring Operator (CMO) により管理されます。これらのコンポーネントには、Prometheus、Alertmanager、Thanos Querier などが含まれます。CMO は、プラットフォーム Prometheus インスタンスから Red Hat にデータのサブセットを送信してクラスターの Remote Health Monitoring を容易にする Telemeter クライアントも導入します。
アプリケーションをメッシュに追加すると、CPU とメモリーの使用状況、ネットワーク接続、その他のリソースの使用状況に関するメトリクスとカスタマイズされたアラートを使用して、OpenShift Container Platform で実行しているアプリケーションのクラスター内の健全性とパフォーマンスを監視できます。
2.1.1. Service Mesh を使用した OpenShift モニタリングの設定
Red Hat OpenShift Service Mesh をユーザーワークロード監視と統合できます。
前提条件
- Red Hat OpenShift Service Mesh がインストールされている。
- ユーザーのワークロードの監視が有効になっている。ユーザー定義プロジェクトのモニタリングの有効化 を参照してください。
手順
servicemonitor.yml
という名前の YAML ファイルを作成して、Istio コントロールプレーンを監視します。ServiceMonitor
オブジェクトの例apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: istiod-monitor namespace: istio-system spec: targetLabels: - app selector: matchLabels: istio: pilot endpoints: - port: http-monitoring interval: 30s
以下のコマンドを実行して、YAML ファイルを適用します。
$ oc apply -f servicemonitor.yml
podmonitor.yml
という名前の YAML ファイルを作成し、Istio プロキシーからメトリクスを収集します。PodMonitor
オブジェクトの例apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: istio-proxies-monitor namespace: istio-system 1 spec: selector: matchExpressions: - key: istio-prometheus-ignore operator: DoesNotExist podMetricsEndpoints: - path: /stats/prometheus interval: 30s relabelings: - action: keep sourceLabels: ["__meta_kubernetes_pod_container_name"] regex: "istio-proxy" - action: keep sourceLabels: ["__meta_kubernetes_pod_annotationpresent_prometheus_io_scrape"] - action: replace regex: (\d+);(([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}) replacement: '[$2]:$1' sourceLabels: ["__meta_kubernetes_pod_annotation_prometheus_io_port","__meta_kubernetes_pod_ip"] targetLabel: "__address__" - action: replace regex: (\d+);((([0-9]+?)(\.|$)){4}) replacement: '$2:$1' sourceLabels: ["__meta_kubernetes_pod_annotation_prometheus_io_port","__meta_kubernetes_pod_ip"] targetLabel: "__address__" - action: labeldrop regex: "__meta_kubernetes_pod_label_(.+)" - sourceLabels: ["__meta_kubernetes_namespace"] action: replace targetLabel: namespace - sourceLabels: ["__meta_kubernetes_pod_name"] action: replace targetLabel: pod_name
- 1
- OpenShift Container Platform モニタリングは
ServiceMonitor
オブジェクトとPodMonitor
オブジェクトのnamespaceSelector
仕様を無視するため、コントロールプレーンの namespace を含むすべてのメッシュ namespace にPodMonitor
オブジェクトを適用する必要があります。
以下のコマンドを実行して、YAML ファイルを適用します。
$ oc apply -f podmonitor.yml
OpenShift コンソールで Observe
Metrics に移動し、クエリー istio_requests_total
を実行します。注記Metrics の実装では、クエリーが結果を返すまでに数分かかる場合があります。