4.16.8. ポリシーセットを使用した Red Hat OpenShift Platform Plus のインストール
Red Hat Openshift Platform Plus ポリシーセットを適用するためのガイダンスは、引き続きお読みください。Red Hat OpenShift ポリシーセットを適用すると、Red Hat Advanced Cluster Security で保護されたクラスターサービスと Compliance Operator がすべての OpenShift Container Platform マネージドクラスターにデプロイされます。
4.16.8.1. 前提条件 リンクのコピーリンクがクリップボードにコピーされました!
ポリシーセットを適用する前に、次の手順を完了してください。
サブスクリプションをクラスターに適用できるようにするには、
policy-configure-subscription-admin-hub.yamlポリシーを適用し、修復アクションをenforceに設定する必要があります。次の YAML をコピーして、コンソールの YAML エディターに貼り付けます。apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: name: policy-configure-subscription-admin-hub annotations: policy.open-cluster-management.io/standards: NIST SP 800-53 policy.open-cluster-management.io/categories: CM Configuration Management policy.open-cluster-management.io/controls: CM-2 Baseline Configuration spec: remediationAction: inform disabled: false policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-configure-subscription-admin-hub spec: remediationAction: inform severity: low object-templates: - complianceType: musthave objectDefinition: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: open-cluster-management:subscription-admin rules: - apiGroups: - app.k8s.io resources: - applications verbs: - '*' - apiGroups: - apps.open-cluster-management.io resources: - '*' verbs: - '*' - apiGroups: - "" resources: - configmaps - secrets - namespaces verbs: - '*' - complianceType: musthave objectDefinition: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: open-cluster-management:subscription-admin roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: open-cluster-management:subscription-admin subjects: - apiGroup: rbac.authorization.k8s.io kind: User name: kube:admin - apiGroup: rbac.authorization.k8s.io kind: User name: system:admin --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-policy-configure-subscription-admin-hub placementRef: name: placement-policy-configure-subscription-admin-hub kind: Placement apiGroup: cluster.open-cluster-management.io subjects: - name: policy-configure-subscription-admin-hub kind: Policy apiGroup: policy.open-cluster-management.io --- apiVersion: cluster.open-cluster-management.io/v1beta1 kind: Placement metadata: name: placement-policy-configure-subscription-admin-hub spec: predicates: - requiredClusterSelector: labelSelector: matchExpressions: - {key: name, operator: In, values: ["local-cluster"]} tolerations: - key: cluster.open-cluster-management.io/unavailable operator: Exists - key: cluster.open-cluster-management.io/unreachable operator: Existsコマンドラインインターフェイスから以前の YAML を適用するには、以下のコマンドを実行します。
oc apply -f policy-configure-subscription-admin-hub.yaml- Policy Generator kustomize プラグインをインストールします。Kustomize v4.5 以降を使用してください。Operator をインストールするためのポリシーの生成 を参照してください。
ポリシーは
policiesnamespace にインストールされます。その namespace をClusterSetにバインドする必要があります。たとえば、以下のサンプル YAML をコピーして適用し、namespace をデフォルトのClusterSetにバインドします。apiVersion: cluster.open-cluster-management.io/v1beta2 kind: ManagedClusterSetBinding metadata: name: default namespace: policies spec: clusterSet: default次のコマンドを実行して、コマンドラインインターフェイスから
ManagedClusterSetBindingリソースを適用します。oc apply -f managed-cluster.yaml
前提条件を満たしたら、ポリシーセットを適用できます。