This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.4. モニタリングスタックの設定
OpenShift Container Platform 4.9 では、 cluster-monitoring-config または user-workload-monitoring-config ConfigMap オブジェクトを使用してモニターリングスタックを設定できます。設定マップはクラスターモニタリング Operator (CMO) を設定し、その後にスタックのコンポーネントが設定されます。
前提条件
OpenShift Container Platform のコアモニタリングコンポーネントを設定する場合、以下を実行します。
-
cluster-adminロールを持つユーザーとしてクラスターにアクセスできる。 -
cluster-monitoring-configConfigMapオブジェクトを作成している。
-
ユーザー定義のプロジェクトをモニターするコンポーネントを設定する場合:
-
cluster-adminロールを持つユーザーとして、またはopenshift-user-workload-monitoringプロジェクトのuser-workload-monitoring-config-editロールを持つユーザーとして、クラスターにアクセスできる。 -
user-workload-monitoring-configConfigMapオブジェクトを作成している。
-
-
OpenShift CLI (
oc) がインストールされている。
手順
ConfigMapオブジェクトを編集します。OpenShift Container Platform のコアモニタリングコンポーネントを設定するには、以下を実行します。
openshift-monitoringプロジェクトでcluster-monitoring-configConfigMapオブジェクトを編集します。oc -n openshift-monitoring edit configmap cluster-monitoring-config
$ oc -n openshift-monitoring edit configmap cluster-monitoring-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow 設定を、
data/config.yamlの下に値とキーのペア<component_name>: <component_configuration>として追加します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow <component>および<configuration_for_the_component>を随時置き換えます。以下の
ConfigMapオブジェクトの例は、Prometheus の永続ボリューム要求 (PVC) を設定します。これは、OpenShift Container Platform のコアコンポーネントのみをモニターする Prometheus インスタンスに関連します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Prometheus コンポーネントを定義し、後続の行はその設定を定義します。
ユーザー定義のプロジェクトをモニターするコンポーネントを設定するには、以下を実行します。
openshift-user-workload-monitoringプロジェクトでuser-workload-monitoring-configConfigMapオブジェクトを編集します。oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-config
$ oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow 設定を、
data/config.yamlの下に値とキーのペア<component_name>: <component_configuration>として追加します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow <component>および<configuration_for_the_component>を随時置き換えます。以下の
ConfigMapオブジェクトの例は、Prometheus のデータ保持期間および最小コンテナーリソース要求を設定します。これは、ユーザー定義のプロジェクトのみをモニターする Prometheus インスタンスに関連します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記Prometheus 設定マップコンポーネントは、
cluster-monitoring-configConfigMapオブジェクトでprometheusK8sと呼ばれ、user-workload-monitoring-configConfigMapオブジェクトでprometheusと呼ばれます。
ファイルを保存して、変更を
ConfigMapオブジェクトに適用します。新規設定の影響を受けた Pod は自動的に再起動されます。注記user-workload-monitoring-configConfigMapオブジェクトに適用される設定は、クラスター管理者がユーザー定義プロジェクトのモニタリングを有効にしない限りアクティブにされません。警告変更がモニタリング設定マップに保存されると、関連するプロジェクトの Pod およびその他のリソースが再デプロイされる可能性があります。該当するプロジェクトの実行中のモニタリングプロセスも再起動する可能性があります。