6.3. 클러스터 비교 플러그인 사용


cluster-compare 플러그인을 사용하면 참조 구성을 라이브 클러스터 또는 필수 수집 데이터의 구성과 비교할 수 있습니다.

6.3.1. 라이브 클러스터와 함께 클러스터 비교 플러그인 사용

cluster-compare 플러그인을 사용하면 참조 구성과 라이브 클러스터의 구성 사용자 정의 리소스(CR)를 비교할 수 있습니다.

설계, 개발 또는 테스트 시나리오에서 참조 구성을 준수하는지 확인하기 위해 라이브 클러스터 구성을 검증합니다.

참고

비운영 환경에서는 라이브 클러스터에만 cluster-compare 플러그인을 사용하세요. 프로덕션 환경에서는 필수 데이터 수집 플러그인을 사용하세요.

사전 요구 사항

  • OpenShift CLI(oc)를 설치합니다.
  • cluster-admin 역할의 사용자로 클러스터에 액세스할 수 있어야 합니다.
  • 클러스터 비교 플러그인을 다운로드하여 PATH 환경 변수에 포함했습니다.
  • 참조 구성에 액세스할 수 있습니다.

프로세스

  • 다음 명령을 사용하여 cluster-compare 플러그인을 실행합니다.

    $ oc cluster-compare -r <path_to_reference_config>/metadata.yaml
    Copy to Clipboard Toggle word wrap
    • -r은 참조 구성의 metadata.yaml 파일에 대한 경로를 지정합니다. 로컬 디렉토리나 URI를 지정할 수 있습니다.

      출력 예

      ...
      
      **********************************
      
      Cluster CR: operator.openshift.io/v1_Console_cluster 
      1
      
      Reference File: optional/console-disable/ConsoleOperatorDisable.yaml 
      2
      
      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: Removed 
      3
      
      +  managementState: Managed
         operatorLogLevel: Normal
      
      **********************************
      
      …
      
      Summary 
      4
      
      CRs with diffs: 5/49 
      5
      
      CRs in reference missing from the cluster: 1 
      6
      
      required-cluster-tuning:
        cluster-tuning:
          Missing CRs: 
      7
      
          - required/cluster-tuning/disabling-network-diagnostics/DisableSnoNetworkDiag.yaml
      No CRs are unmatched to reference CRs 
      8
      
      Metadata Hash: 512a9bf2e57fd5a5c44bbdea7abb3ffd7739d4a1f14ef9021f6793d5cdf868f0 
      9
      
      No patched CRs 
      10
      Copy to Clipboard Toggle word wrap

      1
      비교 중인 CR입니다. 이 플러그인은 각 CR을 해당 템플릿과 다르게 표시합니다.
      2
      비교를 위한 CR과 일치하는 템플릿입니다.
      3
      Linux diff 형식의 출력은 템플릿과 클러스터 CR의 차이점을 보여줍니다.
      4
      플러그인이 각 CR에 대한 줄 차이를 보고한 후, 차이점 요약이 보고됩니다.
      5
      해당 템플릿과의 차이점을 비교한 CR의 수입니다.
      6
      참조 구성에는 표현되었지만 라이브 클러스터에는 누락된 CR의 수입니다.
      7
      참조 구성에 표현되었지만 라이브 클러스터에는 없는 CR 목록입니다.
      8
      참조 구성의 해당 템플릿과 일치하지 않는 CR입니다.
      9
      메타데이터 해시는 참조 구성을 식별합니다.
      10
      패치된 CR 목록입니다.
참고

명령에 -o junit을 추가하면 junit 형식으로 출력을 얻을 수 있습니다. 예를 들면 다음과 같습니다.

$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -o junit
Copy to Clipboard Toggle word wrap

junit 출력에는 다음과 같은 결과 유형이 포함됩니다.

  • 완전히 일치된 각 템플릿에 대한 통과 결과입니다.
  • 필수 사용자 정의 리소스(CR)가 발견되지 않았거나 누락되어 실패한 결과입니다.
  • 사용자 재정의 메커니즘을 사용하여 패치된 차이점에 대한 건너뛴 결과입니다.

6.3.2. 필수 수집 데이터와 함께 클러스터 비교 플러그인 사용

cluster-compare 플러그인을 사용하면 참조 구성을 필수 수집 데이터의 구성 사용자 정의 리소스(CR)와 비교할 수 있습니다.

생산 환경에서 구성 문제를 해결하기 위해 반드시 수집해야 하는 데이터를 사용하여 클러스터 구성을 검증합니다.

참고

프로덕션 환경의 경우 필수 수집 데이터만 포함하는 cluster-compare 플러그인을 사용하세요.

  • 대상 클러스터에서 반드시 수집해야 할 데이터에 액세스할 수 있습니다.
  • OpenShift CLI(oc)를 설치합니다.
  • 클러스터 비교 플러그인을 다운로드하여 PATH 환경 변수에 포함했습니다.
  • 참조 구성에 액세스할 수 있습니다.

프로세스

  • 다음 명령을 실행하여 수집해야 할 데이터를 참조 구성과 비교합니다.

    $ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -f "must-gather*/*/cluster-scoped-resources","must-gather*/*/namespaces" -R
    Copy to Clipboard Toggle word wrap
    • -r은 참조 구성의 metadata.yaml 파일에 대한 경로를 지정합니다. 로컬 디렉토리나 URI를 지정할 수 있습니다.
    • -f는 필수 수집 데이터 디렉토리의 경로를 지정합니다. 로컬 디렉토리나 URI를 지정할 수 있습니다. 이 예제에서는 비교를 관련 클러스터 구성 디렉토리로 제한합니다.
    • -R은 대상 디렉토리를 재귀적으로 검색합니다.

      출력 예

      ...
      
      **********************************
      
      Cluster CR: operator.openshift.io/v1_Console_cluster 
      1
      
      Reference File: optional/console-disable/ConsoleOperatorDisable.yaml 
      2
      
      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: Removed 
      3
      
      +  managementState: Managed
         operatorLogLevel: Normal
      
      **********************************
      
      …
      
      Summary 
      4
      
      CRs with diffs: 5/49 
      5
      
      CRs in reference missing from the cluster: 1 
      6
      
      required-cluster-tuning:
        cluster-tuning:
          Missing CRs: 
      7
      
          - required/cluster-tuning/disabling-network-diagnostics/DisableSnoNetworkDiag.yaml
      No CRs are unmatched to reference CRs 
      8
      
      Metadata Hash: 512a9bf2e57fd5a5c44bbdea7abb3ffd7739d4a1f14ef9021f6793d5cdf868f0 
      9
      
      No patched CRs 
      10
      Copy to Clipboard Toggle word wrap

      1
      비교 중인 CR입니다. 이 플러그인은 각 CR을 해당 템플릿과 다르게 표시합니다.
      2
      비교를 위한 CR과 일치하는 템플릿입니다.
      3
      Linux diff 형식의 출력은 템플릿과 클러스터 CR의 차이점을 보여줍니다.
      4
      플러그인이 각 CR에 대한 줄 차이를 보고한 후, 차이점 요약이 보고됩니다.
      5
      해당 템플릿과의 차이점을 비교한 CR의 수입니다.
      6
      참조 구성에는 표현되었지만 라이브 클러스터에는 누락된 CR의 수입니다.
      7
      참조 구성에 표현되었지만 라이브 클러스터에는 없는 CR 목록입니다.
      8
      참조 구성의 해당 템플릿과 일치하지 않는 CR입니다.
      9
      메타데이터 해시는 참조 구성을 식별합니다.
      10
      패치된 CR 목록입니다.
참고

명령에 -o junit을 추가하면 junit 형식으로 출력을 얻을 수 있습니다. 예를 들면 다음과 같습니다.

$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -f "must-gather*/*/cluster-scoped-resources","must-gather*/*/namespaces" -R -o junit
Copy to Clipboard Toggle word wrap

junit 출력에는 다음과 같은 결과 유형이 포함됩니다.

  • 완전히 일치된 각 템플릿에 대한 통과 결과입니다.
  • 필수 사용자 정의 리소스(CR)가 발견되지 않았거나 누락되어 실패한 결과입니다.
  • 사용자 재정의 메커니즘을 사용하여 패치된 차이점에 대한 건너뛴 결과입니다.

6.3.3. 참조 클러스터 비교 플러그인 옵션

다음 내용은 클러스터 비교 플러그인의 옵션을 설명합니다.

Expand
표 6.1. 클러스터 비교 플러그인 옵션
옵션설명

-A, --all-resources

라이브 클러스터와 함께 사용하는 경우 참조 구성의 유형과 일치하는 클러스터의 모든 리소스를 일치시키려고 시도합니다. 로컬 파일과 함께 사용하는 경우 참조 구성의 유형과 일치하는 로컬 파일의 모든 리소스를 일치시키려고 시도합니다.

--concurrency

라이브 버전의 리소스와 비교할 때 병렬로 처리할 템플릿 수에 대한 정수 값을 지정합니다. 숫자가 클수록 속도는 빨라지지만 해당 기간 동안 메모리, I/O, CPU 사용량도 늘어납니다. 기본값은 4 입니다.

-c, --diff-config

사용자 구성 파일의 경로를 지정합니다.

-f , --파일 이름

참조 구성과 비교하는 데 사용할 구성 사용자 정의 리소스에 대한 파일 이름, 디렉토리 또는 URL을 지정합니다.

--generate-override-for

패치가 필요한 템플릿의 경로를 지정합니다.

--show-template-functions

사용 가능한 템플릿 기능을 표시합니다.

참고

metadata.yaml 파일을 기준으로 하는 대상 템플릿에 파일 경로를 사용해야 합니다. 예를 들어 metadata.yaml 파일의 파일 경로가 ./compare/metadata.yaml 인 경우 템플릿의 상대 파일 경로는 optional/my-template.yaml 일 수 있습니다.

-h, --help

도움말 정보를 표시합니다.

-k,--kustomize

kustomization 디렉터리를 처리할 경로를 지정합니다. 이 플래그는 -f 또는 -R 과 함께 사용할 수 없습니다.

-o, --output

출력 형식을 지정합니다. 옵션에는 json,yaml,junit 또는 generate-patches 가 있습니다.

--override-reason

덮어쓰기를 생성하는 이유를 지정합니다.

-p, --overrides

참조 구성에 대한 패치 덮어쓰기 파일의 경로를 지정합니다.

-R, --recursive

-f,--filename 에 지정된 디렉터리를 반복적으로 처리합니다.

-r,--reference

참조 구성 metadata.yaml 파일의 경로를 지정합니다.

--show-managed-fields

비교에 관리 필드를 포함하려면 true 를 지정합니다.

-v: 자세히

플러그인 출력의 상세 수준을 늘립니다.

6.3.4. 예: telco 코어 참조 구성으로 클러스터 비교

cluster-compare 플러그인을 사용하여 참조 구성을 라이브 클러스터 또는 must-gather 데이터의 구성과 비교할 수 있습니다.

이 예에서는 라이브 클러스터의 구성을 telco 코어 참조 구성과 비교합니다. 통신 핵심 참조 구성은 telco 코어 참조 사양(RDS)에서 파생됩니다. Telco 코어 RDS는 컨트롤 플레인 및 일부 중앙 집중식 데이터 플레인 기능을 포함한 대규모 통신 애플리케이션을 지원하기 위해 클러스터용으로 설계되었습니다.

참조 구성은 telco core RDS를 사용하여 컨테이너 이미지에 패키지됩니다.

telco core 및 telco RAN distributed unit(DU) 프로필과 함께 cluster-compare 플러그인을 사용하는 추가 예제는 "추가 리소스" 섹션을 참조하십시오.

사전 요구 사항

  • cluster-admin 역할의 사용자로 클러스터에 액세스할 수 있어야 합니다.
  • registry.redhat.io 컨테이너 이미지 레지스트리에 액세스하기 위한 인증 정보가 있어야 합니다.
  • cluster-compare 플러그인이 설치되어 있어야 합니다.

프로세스

  1. 다음 명령을 실행하여 인증 정보를 사용하여 컨테이너 이미지 레지스트리에 로그인합니다.

    $ podman login registry.redhat.io
    Copy to Clipboard Toggle word wrap
  2. 다음 명령을 실행하여 telco-core-rds-rhel9 컨테이너 이미지에서 콘텐츠를 추출합니다.

    $ mkdir -p ./out
    Copy to Clipboard Toggle word wrap
    $ podman run -it registry.redhat.io/openshift4/openshift-telco-core-rds-rhel9:v4.18 | base64 -d | tar xv -C out
    Copy to Clipboard Toggle word wrap

    reference-crs-kube-compare/ 디렉터리에서 참조 구성을 볼 수 있습니다.

    out/telco-core-rds/configuration/reference-crs-kube-compare/
    ├── metadata.yaml 
    1
    
    ├── optional 
    2
    
    │   ├── logging
    │   ├── networking
    │   ├── other
    │   └── tuning
    └── required 
    3
    
        ├── networking
        ├── other
        ├── performance
        ├── scheduling
        └── storage
    Copy to Clipboard Toggle word wrap
    1
    참조 구성에 대한 구성 파일입니다.
    2
    선택적 템플릿용 디렉터리입니다.
    3
    필수 템플릿의 디렉터리입니다.
  3. 다음 명령을 실행하여 클러스터의 구성을 telco 코어 참조 구성과 비교합니다.

    $ oc cluster-compare -r out/telco-core-rds/configuration/reference-crs-kube-compare/metadata.yaml
    Copy to Clipboard Toggle word wrap

    출력 예

    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_cluster 
    1
    
    Reference File: required/other/operator-hub.yaml 
    2
    
    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
    
    **********************************
    
    Summary 
    4
    
    CRs with diffs: 3/4 
    5
    
    CRs in reference missing from the cluster: 22 
    6
    
    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 CRs 
    8
    
    Metadata Hash: fe41066bac56517be02053d436c815661c9fa35eec5922af25a1be359818f297 
    9
    
    No patched CRs 
    10
    Copy to Clipboard Toggle word wrap

    1
    비교 중인 CR입니다. 플러그인은 해당 템플릿과 차이가 있는 각 CR을 표시합니다.
    2
    비교를 위해 CR과 일치하는 템플릿입니다.
    3
    Linux diff 형식의 출력은 템플릿과 클러스터 CR의 차이점을 보여줍니다.
    4
    플러그인이 각 CR에 대한 줄 diffs를 보고하면 차이점에 대한 요약이 보고됩니다.
    5
    해당 템플릿의 차이점과 비교한 CR 수입니다.
    6
    참조 구성에 표시되지만 실시간 클러스터에서 누락된 CR 수입니다.
    7
    참조 구성에 표시되지만 실시간 클러스터에서 누락된 CR 목록입니다.
    8
    참조 구성에서 해당 템플릿과 일치하지 않는 CR입니다.
    9
    메타데이터 해시는 참조 구성을 식별합니다.
    10
    패치된 CR 목록입니다.
참고

명령에 -o junit 을 추가하여 junit 형식으로 출력을 가져옵니다. 예를 들면 다음과 같습니다.

$ oc cluster-compare -r out/telco-core-rds/configuration/reference-crs-kube-compare/metadata.yaml -o junit
Copy to Clipboard Toggle word wrap

junit 출력에는 다음 결과 유형이 포함됩니다.

  • 완전히 일치하는 각 템플릿에 대한 결과를 전달합니다.
  • 차이점에 대한 실패한 결과 발견 또는 누락된 CR(사용자 정의 리소스)입니다.
  • 사용자 덮어쓰기 메커니즘을 사용하여 패치된 차이에 대해 건너뛰었습니다.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat