1.5. OpenShift Container Platform GitOps(Argo CD)로 정책 정의 관리


더 이상 사용되지 않음: PlacementRule

Argo CD를 기반으로 하는 OpenShift Container Platform GitOps를 사용하여 정책 정의를 관리할 수도 있습니다. 이 워크플로를 허용하려면 Red Hat Advanced Cluster Management Hub 클러스터에서 정책을 생성할 수 있는 액세스 권한을 OpenShift Container Platform GitOps에 부여해야 합니다. 정책 및 배치를 생성, 읽기, 업데이트 및 삭제할 수 있는 액세스 권한을 사용하여 openshift-gitops-policy-admin 이라는 다음 ClusterRole 리소스를 생성합니다. ClusterRole 은 다음 예와 유사할 수 있습니다.

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openshift-gitops-policy-admin
rules:
  - verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
    apiGroups:
      - policy.open-cluster-management.io
    resources:
      - policies
      - policysets
      - placementbindings
  - verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
    apiGroups:
      - apps.open-cluster-management.io
    resources:
      - placementrules
  - verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
    apiGroups:
      - cluster.open-cluster-management.io
    resources:
      - placements
      - placements/status
      - placementdecisions
      - placementdecisions/status
Copy to Clipboard Toggle word wrap

OpenShift Container Platform GitOps 서비스 계정 액세스 권한을 openshift-gitops-policy-admin ClusterRole 오브젝트에 부여할 ClusterRoleBinding 오브젝트를 생성합니다. ClusterRoleBinding 은 다음 예와 유사할 수 있습니다.

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openshift-gitops-policy-admin
subjects:
  - kind: ServiceAccount
    name: openshift-gitops-argocd-application-controller
    namespace: openshift-gitops
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: openshift-gitops-policy-admin
Copy to Clipboard Toggle word wrap

Red Hat Advanced Cluster Management 정책 정의가 OpenShift Container Platform GitOps와 함께 배포되면 각 관리 클러스터 네임스페이스에 정책 사본이 생성됩니다. 이러한 복사본을 복제 정책이라고 합니다. OpenShift Container Platform GitOps가 복제된 정책을 반복적으로 삭제하지 못하거나 Argo CD 애플리케이션이 동기화되지 않도록 argocd.argoproj.io/compare-options: IgnoreExtraneous 주석은 Red Hat Advanced Cluster Management 정책 프레임워크에서 각 복제 정책에 자동으로 설정됩니다.

Argo CD에서 오브젝트를 추적하는 데 사용하는 레이블 및 주석이 있습니다. Argo CD에 복제 정책이 표시되지 않는 경우 Red Hat Advanced Cluster Management 정책 정의에서 spec.copyPolicyMetadatafalse 로 설정하여 이러한 Argo CD 추적 라벨 및 주석이 복제 정책에 복사되지 않도록 할 수 있습니다.

1.5.1. OpenShift Container Platform GitOps와 정책 생성기 통합 (Argo CD)

Argo CD를 기반으로 하는 OpenShift Container Platform GitOps는 GitOps를 통해 정책 생성기를 사용하여 정책을 생성하는 데 사용할 수도 있습니다. 정책 생성기는 OpenShift Container Platform GitOps 컨테이너 이미지에 사전 설치되지 않으므로 일부 사용자 지정이 수행해야 합니다. 계속하려면 OpenShift Container Platform GitOps Operator가 Red Hat Advanced Cluster Management Hub 클러스터에 설치되어 있어야 하며 hub 클러스터에 로그인해야 합니다.

Kustomize를 실행할 때 OpenShift Container Platform GitOps가 정책 생성기에 액세스하려면 Red Hat Advanced Cluster Management Application Subscription 컨테이너 이미지에서 OpenShift Container Platform GitOps 컨테이너에 있는 Policy Generator 바이너리를 복사해야 합니다. 또한 Kustomize를 실행할 때 --enable-alpha-plugins 플래그를 제공하도록 OpenShift Container Platform GitOps를 구성해야 합니다. 다음 명령을 사용하여 OpenShift Container Platform GitOps argocd 오브젝트 편집을 시작합니다.

oc -n openshift-gitops edit argocd openshift-gitops
Copy to Clipboard Toggle word wrap

그런 다음 다음과 같은 추가 YAML 콘텐츠를 포함하도록 OpenShift Container Platform GitOps argocd 오브젝트를 수정합니다. Red Hat Advanced Cluster Management의 새로운 주요 버전이 릴리스되고 정책 생성기를 최신 버전으로 업데이트하려면 Init Container에서 사용하는 registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel8 이미지를 최신 태그로 업데이트해야 합니다. 다음 예제를 보고 < version >을 2.9 또는 원하는 Red Hat Advanced Cluster Management 버전으로 교체합니다.

apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
  name: openshift-gitops
  namespace: openshift-gitops
spec:
  kustomizeBuildOptions: --enable-alpha-plugins
  repo:
    env:
    - name: KUSTOMIZE_PLUGIN_HOME
      value: /etc/kustomize/plugin
    initContainers:
    - args:
      - -c
      - cp /etc/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator
        /policy-generator/PolicyGenerator
      command:
      - /bin/bash
      image: registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel8:v<version>
      name: policy-generator-install
      volumeMounts:
      - mountPath: /policy-generator
        name: policy-generator
    volumeMounts:
    - mountPath: /etc/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator
      name: policy-generator
    volumes:
    - emptyDir: {}
      name: policy-generator
Copy to Clipboard Toggle word wrap

OpenShift Container Platform GitOps에서 Policy Generator를 사용할 수 있으므로 OpenShift Container Platform GitOps에 Red Hat Advanced Cluster Management Hub 클러스터에 정책을 생성할 수 있는 액세스 권한이 부여되어야 합니다. 정책 및 배치를 생성, 읽기, 업데이트 및 삭제할 수 있는 액세스 권한으로 openshift-gitops-policy-admin 이라는 ClusterRole 리소스를 생성합니다. ealier ClusterRole 예제를 참조하십시오.

또한 ClusterRoleBinding 오브젝트를 생성하여 openshift-gitops-policy-admin ClusterRole 에 대한 OpenShift Container Platform GitOps 서비스 계정 액세스 권한을 부여합니다. ClusterRoleBinding 은 다음 리소스와 유사할 수 있습니다.

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openshift-gitops-policy-admin
subjects:
  - kind: ServiceAccount
    name: openshift-gitops-argocd-application-controller
    namespace: openshift-gitops
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: openshift-gitops-policy-admin
Copy to Clipboard Toggle word wrap

1.5.2. 추가 리소스

  • Argo CD 문서를 참조하십시오.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

Theme

© 2025 Red Hat