第 2 章 使用 RHACM 安装 OpenShift Data Foundation 逻辑卷管理器 Operator
OpenShift Data Foundation 逻辑卷管理器 Operator 使用 Red Hat Advanced Cluster Management for Kubernetes(RHACM)在单一节点 OpenShift(SNO)集群上部署。在将 Operator 应用到与 PlacementRule
中指定的选择器匹配的受管集群时,您在 RHACM 上创建 Policy。该策略也应用于稍后导入并满足 PlacementRule
的集群。
先决条件
-
使用具有
cluster-admin
和 operator 安装权限的账户访问 RHACM 集群。 - 每个 SNO 集群中专用磁盘,供 OpenShift Data Foundation 逻辑卷管理器 Operator 使用。
确保 SNO 集群中没有安装其他存储置备程序。OpenShift Data Foundation Logical Volume Manager Operator 应该是唯一的存储置备程序,因为它使用节点上的所有可用磁盘。
流程
使用您的 OpenShift 凭证登录 RHACM CLI。
如需更多信息,请参阅安装 Red Hat Advanced Cluster Management for Kubernetes。
创建命名空间。
# oc create ns lvm-policy-ns
在命名空间中创建策略 YAML。
# This policy verifies the installation of the official version of the OpenShift Data Foundation # Logical Volume Manager Operator on the managed clusters. # If set to "enforce" it installs the operator. # Used APIs: OLM, ODF-LVMO #https://github.com/operator-framework/operator-lifecycle-manager # https://github.com/red-hat-storage/lvm-operator apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: annotations: policy.open-cluster-management.io/categories: CM Configuration Management policy.open-cluster-management.io/controls: CM-2 Baseline Configuration policy.open-cluster-management.io/standards: NIST SP 800-53 name: policy-lvm-operator spec: disabled: false remediationAction: enforce policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvm-namespace spec: object-templates: - complianceType: musthave objectDefinition: apiVersion: v1 kind: Namespace metadata: name: openshift-storage labels: openshift.io/cluster-monitoring: "true" remediationAction: enforce severity: high - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvm-operator-operatorgroup spec: object-templates: - complianceType: musthave objectDefinition: apiVersion: operators.coreos.com/v1alpha2 kind: OperatorGroup metadata: name: openshift-storage-operatorgroup namespace: openshift-storage spec: targetNamespaces: - openshift-storage remediationAction: enforce severity: high - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvm-operator-subscription spec: object-templates: - complianceType: musthave objectDefinition: apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: odf-lvm-operator namespace: openshift-storage spec: channel: stable-4.10 installPlanApproval: Automatic name: odf-lvm-operator source: redhat-operators sourceNamespace: openshift-marketplace startingCSV: odf-lvm-operator.v4.10.0 remediationAction: enforce severity: high - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvmcluster spec: object-templates: - complianceType: musthave objectDefinition: apiVersion: lvm.topolvm.io/v1alpha1 kind: LVMCluster metadata: name: odf-lvmcluster namespace: openshift-storage spec: storage: deviceClasses: - name: vg1 remediationAction: enforce severity: high
运行以下命令:
# oc create -f policy-lvm-operator.yaml -n lvm-policy-ns
这会创建
Policy
、PlacementRule
和PlacementBinding
。Policy
创建一个命名空间
、OperatorGroup
、Subscription
和LVMCluster
资源。这会在与选择条件匹配的 SNO 集群上部署 Operator,并将其配置为设置所需资源以置备存储。在安装后,Operator 会使用所有未使用的磁盘。