第 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 应该是唯一的存储置备程序,因为它使用节点上的所有可用磁盘。

流程

  1. 使用您的 OpenShift 凭证登录 RHACM CLI。

    如需更多信息,请参阅安装 Red Hat Advanced Cluster Management for Kubernetes

  2. 创建命名空间。

    # oc create ns lvm-policy-ns
  3. 在命名空间中创建策略 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
  4. 运行以下命令:

    # oc create -f policy-lvm-operator.yaml -n lvm-policy-ns

    这会创建 PolicyPlacementRulePlacementBindingPolicy 创建一个命名空间OperatorGroupSubscriptionLVMCluster 资源。这会在与选择条件匹配的 SNO 集群上部署 Operator,并将其配置为设置所需资源以置备存储。在安装后,Operator 会使用所有未使用的磁盘。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.