6.3. cluster-compare プラグインの使用
cluster-compare プラグインを使用すると、リファレンス設定をライブクラスターまたは must-gather データからの設定と比較できます。
6.3.1. ライブクラスターでの cluster-compare プラグインの使用 リンクのコピーリンクがクリップボードにコピーされました!
cluster-compare プラグインを使用すると、リファレンス設定をライブクラスターの設定カスタムリソース (CR) と比較できます。
設計中、開発中、またはテスト中に、ライブクラスターの設定を検証し、リファレンス設定に準拠していることを確認してください。
cluster-compare プラグインは、非実稼働環境のライブクラスターでのみ使用してください。実稼働環境の場合は、must-gather データに対してプラグインを使用してください。
前提条件
-
OpenShift CLI (
oc) がインストールされている。 -
cluster-adminロールを持つユーザーとしてクラスターにアクセスできる。 -
cluster-compareプラグインをダウンロードし、PATH環境変数に含めた。 - リファレンス設定にアクセスできる。
手順
次のコマンドを使用して、
cluster-compareプラグインを実行します。$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml-rは、リファレンス設定のmetadata.yamlファイルへのパスを指定します。ローカルディレクトリーまたは URI を指定できます。出力例
... ********************************** Cluster CR: operator.openshift.io/v1_Console_cluster1 Reference File: optional/console-disable/ConsoleOperatorDisable.yaml2 Diff Output: diff -u -N /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 +++ /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 @@ -4,5 +4,5 @@ name: cluster spec: logLevel: Normal - managementState: Removed3 + managementState: Managed operatorLogLevel: Normal ********************************** … Summary4 CRs with diffs: 5/495 CRs in reference missing from the cluster: 16 required-cluster-tuning: cluster-tuning: Missing CRs:7 - required/cluster-tuning/disabling-network-diagnostics/DisableSnoNetworkDiag.yaml No CRs are unmatched to reference CRs8 Metadata Hash: 512a9bf2e57fd5a5c44bbdea7abb3ffd7739d4a1f14ef9021f6793d5cdf868f09 No patched CRs10 - 1
- 比較対象の CR。プラグインにより、対応するテンプレートとの差異のある各 CR が表示されます。
- 2
- 比較対象の CR とマッチするテンプレート。
- 3
- Linux diff 形式の出力に、テンプレートとクラスター CR の差異が表示されます。
- 4
- プラグインにより、各 CR の行の差分が報告されます。その後、差分の概要が報告されます。
- 5
- 対応するテンプレートとの差異を比較した CR の数。
- 6
- リファレンス設定に表されているが、ライブクラスターには存在しない CR の数。
- 7
- リファレンス設定に表されているが、ライブクラスターには存在しない CR のリスト。
- 8
- リファレンス設定内の対応するテンプレートとマッチしなかった CR。
- 9
- メタデータハッシュはリファレンス設定を識別するものです。
- 10
- パッチが適用された CR のリスト。
6.3.2. must-gather データでの cluster-compare プラグインの使用 リンクのコピーリンクがクリップボードにコピーされました!
cluster-compare プラグインを使用すると、リファレンス設定を must-gather データからの設定カスタムリソース (CR) と比較できます。
must-gather データを使用してクラスター設定を検証し、実稼働環境での設定の問題をトラブルシューティングします。
実稼働環境の場合は、必ず must-gather データに対して cluster-compare プラグインを使用してください。
-
ターゲットクラスターから
must-gatherデータにアクセスできる。 -
OpenShift CLI (
oc) がインストールされている。 -
cluster-compareプラグインをダウンロードし、PATH環境変数に含めた。 - リファレンス設定にアクセスできる。
手順
次のコマンドを実行して、
must-gatherデータをリファレンス設定と比較します。$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -f "must-gather*/*/cluster-scoped-resources","must-gather*/*/namespaces" -R-
-rは、リファレンス設定のmetadata.yamlファイルへのパスを指定します。ローカルディレクトリーまたは URI を指定できます。 -
-fは、must-gatherデータディレクトリーへのパスを指定します。ローカルディレクトリーまたは URI を指定できます。この例では、比較対象を重要なクラスター設定ディレクトリーに制限します。 -Rは、ターゲットディレクトリーを再帰的に検索します。出力例
... ********************************** Cluster CR: operator.openshift.io/v1_Console_cluster1 Reference File: optional/console-disable/ConsoleOperatorDisable.yaml2 Diff Output: diff -u -N /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 +++ /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 @@ -4,5 +4,5 @@ name: cluster spec: logLevel: Normal - managementState: Removed3 + managementState: Managed operatorLogLevel: Normal ********************************** … Summary4 CRs with diffs: 5/495 CRs in reference missing from the cluster: 16 required-cluster-tuning: cluster-tuning: Missing CRs:7 - required/cluster-tuning/disabling-network-diagnostics/DisableSnoNetworkDiag.yaml No CRs are unmatched to reference CRs8 Metadata Hash: 512a9bf2e57fd5a5c44bbdea7abb3ffd7739d4a1f14ef9021f6793d5cdf868f09 No patched CRs10 - 1
- 比較対象の CR。プラグインにより、対応するテンプレートとの差異のある各 CR が表示されます。
- 2
- 比較対象の CR とマッチするテンプレート。
- 3
- Linux diff 形式の出力に、テンプレートとクラスター CR の差異が表示されます。
- 4
- プラグインにより、各 CR の行の差分が報告されます。その後、差分の概要が報告されます。
- 5
- 対応するテンプレートとの差異を比較した CR の数。
- 6
- リファレンス設定に表されているが、ライブクラスターには存在しない CR の数。
- 7
- リファレンス設定に表されているが、ライブクラスターには存在しない CR のリスト。
- 8
- リファレンス設定内の対応するテンプレートとマッチしなかった CR。
- 9
- メタデータハッシュはリファレンス設定を識別するものです。
- 10
- パッチが適用された CR のリスト。
-
6.3.3. cluster-compare プラグインのオプションのリファレンス リンクのコピーリンクがクリップボードにコピーされました!
ここでは、cluster-compare プラグインのオプションを説明します。
| オプション | 説明 |
|---|---|
|
| ライブクラスターで使用すると、リファレンス設定内のタイプに一致するクラスター内の全リソースとのマッチングを試行します。ローカルファイルで使用すると、リファレンス設定内のタイプに一致するローカルファイル内の全リソースとのマッチングを試行します。 |
|
|
ライブバージョンのリソースと比較するときに、並列処理するテンプレートの数の整数値を指定します。数値が大きいほど速度は増加しますが、その期間中のメモリー、I/O、CPU の使用率も増加します。デフォルト値は |
|
| ユーザー設定ファイルへのパスを指定します。 |
|
| リファレンス設定との比較に使用する設定カスタムリソースのファイル名、ディレクトリー、または URL を指定します。 |
|
| パッチが必要なテンプレートのパスを指定します。 注記
|
|
| ヘルプ情報を表示します。 |
|
|
|
|
|
出力形式を指定します。 |
|
| オーバーライドを生成する理由を指定します。 |
|
| リファレンス設定のパッチオーバーライドファイルへのパスを指定します。 |
|
|
|
|
|
リファレンス設定の |
|
|
マネージドフィールドを比較に含めるには |
|
| プラグイン出力の詳細度を高めます。 |
6.3.4. 例: クラスターと通信事業者コアリファレンス設定の比較 リンクのコピーリンクがクリップボードにコピーされました!
cluster-compare プラグインを使用すると、リファレンス設定をライブクラスターまたは must-gather データからの設定と比較できます。
この例では、ライブクラスターの設定と通信事業者コアリファレンス設定を比較します。通信事業者コアリファレンス設定は、通信事業者コアリファレンス設計仕様 (RDS) に基づくものです。通信事業者コア RDS は、コントロールプレーンや一部の集中型データプレーン機能を含む大規模な通信事業者アプリケーションを支えるクラスター向けに設計されています。
リファレンス設定は、通信事業者コア RDS とともにコンテナーイメージにパッケージ化されています。
cluster-compare プラグインを通信事業者コアプロファイルおよび通信事業者 RAN 分散ユニット (DU) プロファイルとともに使用する例は、「関連情報」セクションを参照してください。
前提条件
-
cluster-adminロールを持つユーザーとしてクラスターにアクセスできる。 -
registry.redhat.ioコンテナーイメージレジストリーにアクセスするための認証情報がある。 -
cluster-compareプラグインをインストールした。
手順
次のコマンドを実行して、認証情報を使用してコンテナーイメージレジストリーにログオンします。
$ podman login registry.redhat.io次のコマンドを実行して、
telco-core-rds-rhel9コンテナーイメージからコンテンツを抽出します。$ mkdir -p ./out$ podman run -it registry.redhat.io/openshift4/openshift-telco-core-rds-rhel9:v4.18 | base64 -d | tar xv -C outリファレンス設定は、
reference-crs-kube-compare/ディレクトリーで確認できます。out/telco-core-rds/configuration/reference-crs-kube-compare/ ├── metadata.yaml1 ├── optional2 │ ├── logging │ ├── networking │ ├── other │ └── tuning └── required3 ├── networking ├── other ├── performance ├── scheduling └── storage次のコマンドを実行して、クラスターの設定を通信事業者コアリファレンス設定と比較します。
$ oc cluster-compare -r out/telco-core-rds/configuration/reference-crs-kube-compare/metadata.yaml出力例
W1212 14:13:06.281590 36629 compare.go:425] Reference Contains Templates With Types (kind) Not Supported By Cluster: BFDProfile, BGPAdvertisement, BGPPeer, ClusterLogForwarder, Community, IPAddressPool, MetalLB, MultiNetworkPolicy, NMState, NUMAResourcesOperator, NUMAResourcesScheduler, NodeNetworkConfigurationPolicy, SriovNetwork, SriovNetworkNodePolicy, SriovOperatorConfig, StorageCluster ... ********************************** Cluster CR: config.openshift.io/v1_OperatorHub_cluster1 Reference File: required/other/operator-hub.yaml2 Diff Output: diff -u -N /tmp/MERGED-2801470219/config-openshift-io-v1_operatorhub_cluster /tmp/LIVE-2569768241/config-openshift-io-v1_operatorhub_cluster --- /tmp/MERGED-2801470219/config-openshift-io-v1_operatorhub_cluster 2024-12-12 14:13:22.898756462 +0000 +++ /tmp/LIVE-2569768241/config-openshift-io-v1_operatorhub_cluster 2024-12-12 14:13:22.898756462 +0000 @@ -1,6 +1,6 @@ apiVersion: config.openshift.io/v1 kind: OperatorHub metadata: + annotations:3 + include.release.openshift.io/hypershift: "true" name: cluster -spec: - disableAllDefaultSources: true ********************************** Summary4 CRs with diffs: 3/45 CRs in reference missing from the cluster: 226 other: other: Missing CRs:7 - optional/other/control-plane-load-kernel-modules.yaml - optional/other/worker-load-kernel-modules.yaml required-networking: networking-root: Missing CRs: - required/networking/nodeNetworkConfigurationPolicy.yaml networking-sriov: Missing CRs: - required/networking/sriov/sriovNetwork.yaml - required/networking/sriov/sriovNetworkNodePolicy.yaml - required/networking/sriov/SriovOperatorConfig.yaml - required/networking/sriov/SriovSubscription.yaml - required/networking/sriov/SriovSubscriptionNS.yaml - required/networking/sriov/SriovSubscriptionOperGroup.yaml required-other: scheduling: Missing CRs: - required/other/catalog-source.yaml - required/other/icsp.yaml required-performance: performance: Missing CRs: - required/performance/PerformanceProfile.yaml required-scheduling: scheduling: Missing CRs: - required/scheduling/nrop.yaml - required/scheduling/NROPSubscription.yaml - required/scheduling/NROPSubscriptionNS.yaml - required/scheduling/NROPSubscriptionOperGroup.yaml - required/scheduling/sched.yaml required-storage: storage-odf: Missing CRs: - required/storage/odf-external/01-rook-ceph-external-cluster-details.secret.yaml - required/storage/odf-external/02-ocs-external-storagecluster.yaml - required/storage/odf-external/odfNS.yaml - required/storage/odf-external/odfOperGroup.yaml - required/storage/odf-external/odfSubscription.yaml No CRs are unmatched to reference CRs8 Metadata Hash: fe41066bac56517be02053d436c815661c9fa35eec5922af25a1be359818f2979 No patched CRs10 - 1
- 比較対象の CR。プラグインにより、対応するテンプレートとの差異のある各 CR が表示されます。
- 2
- 比較対象の CR とマッチするテンプレート。
- 3
- Linux diff 形式の出力に、テンプレートとクラスター CR の差異が表示されます。
- 4
- プラグインにより、各 CR の行の差分が報告されます。その後、差分の概要が報告されます。
- 5
- 対応するテンプレートとの差異を比較した CR の数。
- 6
- リファレンス設定に表されているが、ライブクラスターには存在しない CR の数。
- 7
- リファレンス設定に表されているが、ライブクラスターには存在しない CR のリスト。
- 8
- リファレンス設定内の対応するテンプレートとマッチしなかった CR。
- 9
- メタデータハッシュはリファレンス設定を識別するものです。
- 10
- パッチが適用された CR のリスト。