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.6 では、 cluster-monitoring-config
または user-workload-monitoring-config
ConfigMap
オブジェクトを使用してモニタリングスタックを設定できます。設定マップはクラスターモニタリング Operator (CMO) を設定し、その後にスタックのコンポーネントが設定されます。
前提条件
OpenShift Container Platform のコアモニタリングコンポーネントを設定する場合、以下を実行します。
-
cluster-admin
ロールを持つユーザーとしてクラスターにアクセスできる。 -
cluster-monitoring-config
ConfigMap
オブジェクトを作成している。
-
ユーザー定義のプロジェクトをモニターするコンポーネントを設定する場合:
-
cluster-admin
ロールを持つユーザーとして、またはopenshift-user-workload-monitoring
プロジェクトのuser-workload-monitoring-config-edit
ロールを持つユーザーとして、クラスターにアクセスできる。 -
user-workload-monitoring-config
ConfigMap
オブジェクトを作成している。
-
-
OpenShift CLI (
oc
) がインストールされている。
手順
ConfigMap
オブジェクトを編集します。OpenShift Container Platform のコアモニタリングコンポーネントを設定するには、以下を実行します。
openshift-monitoring
プロジェクトでcluster-monitoring-config
ConfigMap
オブジェクトを編集します。oc -n openshift-monitoring edit configmap cluster-monitoring-config
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
Copy 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-config
ConfigMap
オブジェクトを編集します。oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-config
$ oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-config
Copy 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-config
ConfigMap
オブジェクトでprometheusK8s
と呼ばれ、user-workload-monitoring-config
ConfigMap
オブジェクトでprometheus
と呼ばれます。
ファイルを保存して、変更を
ConfigMap
オブジェクトに適用します。新規設定の影響を受けた Pod は自動的に再起動されます。注記user-workload-monitoring-config
ConfigMap
オブジェクトに適用される設定は、クラスター管理者がユーザー定義プロジェクトのモニタリングを有効にしない限りアクティブにされません。警告変更がモニタリング設定マップに保存されると、関連するプロジェクトの Pod およびその他のリソースが再デプロイされる可能性があります。該当するプロジェクトの実行中のモニタリングプロセスも再起動する可能性があります。