9.2. フェデレーションエンドポイントからのクラスターメトリクスの収集
OpenShift Container Platform クラスターのフェデレーションエンドポイントを使用して、Red Hat OpenStack Services on OpenShift (RHOSO) クラスターでメトリクスを利用できるようにし、プルベースのモニタリングを実行できます。
前提条件
- RHOSO と、その上で実行されているテナントクラスターへの管理アクセス権がある。
- RHOSO 環境でテレメトリーが有効になっている。
- Cluster Observability Operator がクラスターにインストールされている。
- クラスターのモニタリングスタックが設定されている。
- クラスターのフェデレーションエンドポイントが公開されている。
手順
-
ユーザー名とパスワードを使用してクラスターに接続します。インストールプログラムによって生成された
kubeconfigファイルを使用してログインしないでください。 OpenShift Container Platform クラスターからトークンを取得するために、次のコマンドを実行します。
$ oc whoami -t次のコマンドを実行して、RHOSO 管理クラスターの
openstacknamespace でトークンをシークレットとして使用できるようにします。$ oc -n openstack create secret generic ocp-federated --from-literal=token=<the_token_fetched_previously>OpenShift Container Platform クラスターから Prometheus フェデレーションルート URL を取得するために、次のコマンドを実行します。
$ oc -n openshift-monitoring get route prometheus-k8s-federate -ojsonpath={'.status.ingress[].host'}スクレイプ設定のマニフェストを記述し、
cluster-scrape-config.yamlというファイルとして保存します。たとえば、以下のようになります。apiVersion: monitoring.rhobs/v1alpha1 kind: ScrapeConfig metadata: labels: service: metricStorage name: sos1-federated namespace: openstack spec: params: 'match[]': - '{__name__=~"kube_node_info|kube_persistentvolume_info|cluster:master_nodes"}'1 metricsPath: '/federate' authorization: type: Bearer credentials: name: ocp-federated2 key: token scheme: HTTPS # or HTTP scrapeInterval: 30s3 staticConfigs: - targets: - prometheus-k8s-federate-openshift-monitoring.apps.openshift.example4 RHOSO 管理クラスターに接続しているときに、次のコマンドを実行してマニフェストを適用します。
$ oc apply -f cluster-scrape-config.yaml
設定が伝播されると、クラスターメトリクスが RHOSO の OpenShift Container Platform UI で照会可能になります。