ヘルスメトリクス
クラスター全体のヘルスメトリクスとモニタリングについて説明します。
概要
第1章 ヘルスメトリクス リンクのコピーリンクがクリップボードにコピーされました!
メトリクスを使用してコンポーネントの正常性を監視できます。
以下のドキュメントを参照してください。
1.1. メトリクスサービスの使用 リンクのコピーリンクがクリップボードにコピーされました!
メトリクスを使用して、Red Hat Advanced Cluster Management for Kubernetes 全体のコンポーネントの正常性を監視できます。多くのカスタムメトリックは、メトリッククロニクルの概要 に記載されています。
1.1.1. ハブクラスターメトリクスサービスへのアクセス リンクのコピーリンクがクリップボードにコピーされました!
収集されたメトリクスを表示するには、ハブクラスター上でメトリクスサービスを公開する必要があります。メトリクスがすでに Grafana ダッシュボードに公開されている場合、この手順はオプションです。
OpenShift Container Platform コンソールから、メトリクスサービスを見つけます。Observe > Metrics をクリックします。
Grafana ダッシュボード、Grafana Explorer、または OpenShift Container Platform コンソールにメトリクスが表示されない場合は、Prometheus がメトリクスを取得するように設定されていない可能性があります。Prometheus を使用したスクラッチ に進み、メトリクスを公開してください。
1.1.2. Prometheus を使用したスクレイピング リンクのコピーリンクがクリップボードにコピーされました!
Prometheus を使用すると、製品コンソールから公開されていないメトリクスを公開できます。ハブとマネージドクラスターのメトリクスの手順を参照してください。
1.1.2.1. ハブクラスターのスクレイピング リンクのコピーリンクがクリップボードにコピーされました!
ハブクラスターのメトリクスを公開する手順は次のとおりです。これらのファイルは、openshift-monitoring namespace 内にあります。
サービスを収集し、メトリクスを公開するための
ServiceMonitorを作成します。以下は、YAML の例です。apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: hub-subscription-metrics namespace: openshift-monitoring spec: endpoints: - port: metrics namespaceSelector: matchNames: - open-cluster-management selector: matchLabels: app: hub-subscription-metrics次のコマンドを実行して、ファイルを適用します。
oc apply -fモニタリング権限を設定する
Roleを作成します。以下は、その YAML ファイルです。apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: prometheus-k8s-monitoring namespace: open-cluster-management rules: - apiGroups: - "" resources: - services - endpoints - pods verbs: - get - list - watch - apiGroups: - extensions resources: - ingresses verbs: - get - list - watch - apiGroups: - networking.k8s.io resources: - ingresses verbs: - get - list - watch次のコマンドを実行して、ファイルを適用します。
oc apply -f次の例のように、Prometheus モニタリング
ServiceAccountにロールをバインドするためのRoleBindingを作成します。apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: prometheus-k8s-monitoring-binding namespace: open-cluster-management roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: prometheus-k8s-monitoring subjects: - kind: ServiceAccount name: prometheus-k8s namespace: monitoring次のコマンドを実行して、ファイルを適用します。
oc apply -f検証するには、ダッシュボードで次のクエリーを実行し、Subscription Operator Metrics Service により報告されるメトリクスを見つけます。
{service="hub-subscription-metrics"}
1.1.2.2. マネージドクラスターのスクレイピング リンクのコピーリンクがクリップボードにコピーされました!
マネージドクラスターのメトリクスを公開するには、次の手順を実行します。これらのファイルは、openshift-monitoring namespace 内にあります。
メトリクスを公開するサービスを収集する
ServiceMonitorを作成します。以下は、YAML ファイルの例です。apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: mc-subscription-metrics namespace: openshift-monitoring spec: endpoints: - port: metrics namespaceSelector: matchNames: - open-cluster-management-agent-addon selector: matchLabels: app: mc-subscription-metrics次のコマンドを実行してファイルを適用します。
oc apply -fモニタリング権限を設定する
Roleを作成します。以下は、YAML ファイルの例です。apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: prometheus-k8s-monitoring namespace: open-cluster-management-agent-addon rules: - apiGroups: - "" resources: - services - endpoints - pods verbs: - get - list - watch - apiGroups: - extensions resources: - ingresses verbs: - get - list - watch - apiGroups: - networking.k8s.io resources: - ingresses verbs: - get - list - watch次のコマンドを実行して、ファイルを適用します。
oc apply -fPrometheus モニタリング
ServiceAccountにRoleをバインドするRoleBindingを作成します。apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: prometheus-k8s-monitoring-binding namespace: open-cluster-management-agent-addon roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: prometheus-k8s-monitoring subjects: - kind: ServiceAccount name: prometheus-k8s namespace: monitoring次のコマンドを実行して、ファイルを適用します。
oc apply -fPrometheusダッシュボードで次のクエリーを実行し、Subscription Operator Metrics Service により報告されるメトリクスを見つけて検証します。{service="mc-subscription-metrics"}
1.1.3. スタンドアロンクラスターのスクレイピング リンクのコピーリンクがクリップボードにコピーされました!
メトリクスを公開するサービスを収集するための
ServiceMonitorを作成します。apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: standalone-subscription-metrics namespace: openshift-monitoring spec: endpoints: - port: metrics namespaceSelector: matchNames: - open-cluster-management selector: matchLabels: app: standalone-subscription-metricsモニタリング権限を設定するための
Roleを作成します。oc apply -fapiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: prometheus-k8s-monitoring namespace: open-cluster-management rules: - apiGroups: - "" resources: - services - endpoints - pods verbs: - get - list - watch - apiGroups: - extensions resources: - ingresses verbs: - get - list - watch - apiGroups: - networking.k8s.io resources: - ingresses verbs: - get - list - watchPrometheus モニタリング
ServiceAccountにRoleをバインドするためのRoleBindingを作成します。以下は、YAML ファイルの例です。apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: prometheus-k8s-monitoring-binding namespace: open-cluster-management roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: prometheus-k8s-monitoring subjects: - kind: ServiceAccount name: prometheus-k8s namespace: monitoring次のコマンドを実行して、ファイルを適用します。
oc apply -fPrometheusダッシュボードで次のクエリーを実行し、Subscription Operator Metrics Service により報告されるメトリクスを見つけて検証します。{service="standalone-subscription-metrics"}