搜索

附加组件

download PDF
Red Hat Advanced Cluster Management for Kubernetes 2.10

附加组件

摘要

请参阅更多信息,了解如何为集群使用附加组件。

第 1 章 附加组件概述

Red Hat Advanced Cluster Management for Kubernetes 附加组件可以提高某些性能方面,并添加用于增强应用程序的功能。以下小节提供了 Red Hat Advanced Cluster Management 可用的附加组件概述:

1.1. 在集群中为集群管理启用 klusterlet 附加组件

安装 Red Hat Advanced Cluster Management for Kubernetes 后,然后使用多集群引擎 Operator 创建或导入集群,您可以为这些受管集群启用 klusterlet 附加组件。如果您创建或导入集群,否则 Red Hat Advanced Cluster Management 控制台创建或导入,则不会启用 klusterlet 附加组件。请参阅以下可用的 klusterlet 附加组件:

  • application-manager
  • cert-policy-controller
  • config-policy-controller
  • iam-policy-controller
  • governance-policy-framework
  • search-collector

完成以下步骤,在安装 Red Hat Advanced Cluster Management 后为受管集群启用 klusterlet 附加组件:

  1. 创建一个类似于以下 KlusterletAddonConfig 的 YAML 文件,其 spec 值代表附加组件:

    apiVersion: agent.open-cluster-management.io/v1
    kind: KlusterletAddonConfig
    metadata:
      name: <cluster_name>
      namespace: <cluster_name>
    spec:
      applicationManager:
        enabled: true
      certPolicyController:
        enabled: true
      iamPolicyController:
        enabled: true
      policyController: 1
        enabled: true
      searchCollector:
        enabled: true
    1
    policy-controller 附加组件分为两个附加组件:governance-policy-frameworkconfig-policy-controller。因此,policyController 控制 governance-policy-frameworkconfig-policy-controller managedClusterAddons
  2. 将文件保存为 klusterlet-addon-config.yaml
  3. 在 hub 集群中运行以下命令来应用 YAML:

    oc apply -f klusterlet-addon-config.yaml
  4. 要验证在创建 KlusterletAddonConfig 后是否创建了已启用的 managedClusterAddons,请运行以下命令:

    oc get managedclusteraddons -n <cluster namespace>

1.2. 为 klusterlet 附加组件配置 nodeSelectors 和 tolerations

在 Red Hat Advanced Cluster Management 中,您可以为以下 klusterlet 附加组件配置 nodeSelector 和 tolerations:

  • application-manager
  • cert-policy-controller
  • cluster-proxy
  • config-policy-controller
  • governance-policy-framework
  • hypershift-addon
  • iam-policy-controller
  • managed-serviceaccount
  • observability-controller
  • search-collector
  • submariner
  • volsync
  • work-manager

完成以下步骤:

  1. 使用 AddonDeploymentConfig API 创建一个配置,在用于 Red Hat Advanced Cluster Management 安装的命名空间中指定 nodeSelectortolerations
  2. 根据以下模板,创建一个名为 addondeploymentconfig.yaml 的文件:

    apiVersion: addon.open-cluster-management.io/v1alpha1
    kind: AddOnDeploymentConfig
    metadata:
      name: config-name 1
      namespace: config-name-space 2
    spec:
      nodePlacement:
        nodeSelector: node-selector 3
        tolerations: tolerations 4
    1
    config-name 替换为您刚才创建的 AddonDeploymentConfig 的名称。
    2
    config-namespace 替换为您刚才创建的 AddonDeploymentConfig 的命名空间。
    3
    node-selector 替换为您的节点选择器。
    4
    tolerations 替换为您的容限。

    完成的 AddOnDeployment 文件可能类似以下示例:

    apiVersion: addon.open-cluster-management.io/v1alpha1
    kind: AddOnDeploymentConfig
    metadata:
      name: deploy-config
      namespace: open-cluster-management-hub
    spec:
      nodePlacement:
        nodeSelector:
          "node-dedicated": "acm-addon"
        tolerations:
          - effect: NoSchedule
            key: node-dedicated
            value: acm-addon
            operator: Equal
  3. 运行以下命令以应用您创建的文件:

    oc apply -f addondeploymentconfig
  4. 运行以下命令,使用您创建的配置作为附加组件的全局默认配置:

    oc patch clustermanagementaddons <addon-name> --type='json' -p='[{"op":"add", "path":"/spec/supportedConfigs", "value":[{"group":"addon.open-cluster-management.io","resource":"addondeploymentconfigs", "defaultConfig":{"name":"deploy-config","namespace":"open-cluster-management-hub"}}]}]'
    • addon-name 替换为您的附加组件名称。
    • config-name 替换为您刚才创建的 AddonDeploymentConfig 的名称。
    • config-namespace 替换为您刚才创建的 AddonDeploymentConfig 的命名空间。

您指定的 nodeSelectortolerations 应用到每个受管集群的所有附加组件。

您还可以按照以下步骤覆盖特定受管集群中附加组件的全局默认 AddonDeploymentConfig 配置:

  1. 使用 AddonDeploymentConfig API 创建另一个配置,以指定 hub 集群上的 nodeSelectortolerations
  2. 将您创建的新配置链接到受管集群的附加组件 ManagedClusterAddon

    oc -n <managed-cluster> patch managedclusteraddons <addon-name> --type='json' -p='[{"op":"add", "path":"/spec/configs", "value":[
    
    {"group":"addon.open-cluster-management.io","resource":"addondeploymentconfigs","namespace":"<config-namespace>","name":"<config-name>"}
    ]}]'
    • managed-cluster 替换为您的受管集群名称
    • addon-name 替换为您的附加组件名称
    • config-namespace 替换为您刚才创建的 AddonDeploymentConfig 的命名空间
    • config-name 替换为您刚才创建的 AddonDeploymentConfig 的名称

您在 add-on ManagedClusterAddon 中引用的新配置会覆盖您之前在 ClusterManagementAddon 附加组件中定义的全局默认配置。

1.3. 在现有集群附加组件上启用集群范围代理

您可以在集群命名空间中配置 KlusterletAddonConfig,将代理环境变量添加到受管 Red Hat OpenShift Container Platform 集群的所有 klusterlet 附加组件 pod 中。完成以下步骤以配置 KlusterletAddonConfig,将三个环境变量添加到 klusterlet 附加组件的 pod 中:

  1. 编辑位于需要代理的集群的 KlusterletAddonConfig 文件。您可以使用控制台查找资源,也可以使用以下命令在终端中编辑:

    oc -n <my-cluster-name> edit klusterletaddonconfig <my-cluster-name>

    注: 如果您只使用一个集群,则不需要命令末尾的 <my-cluster-name>。使用以下命令:

    oc -n <my-cluster-name> edit klusterletaddonconfig
  2. 编辑文件的 .spec.proxyConfig 部分,使其类似以下示例。spec.proxyConfig 是一个可选部分:

    spec
      proxyConfig:
        httpProxy: "<proxy_not_secure>" 1
        httpsProxy: "<proxy_secure>" 2
        noProxy: "<no_proxy>" 3
    1
    proxy_not_secure 替换为 http 请求的代理服务器的地址。例如,使用 http://192.168.123.145:3128
    2
    使用 https 请求的代理服务器的地址替换 proxy_secure。例如,使用 https://192.168.123.145:3128
    3
    使用以逗号分隔的 IP 地址、主机名和域名列表替换 no_proxy,其中没有通过代理路由流量。例如,使用 .cluster.local,.svc,10.128.0.0/14,example.com

    如果使用在 hub 集群上配置的集群范围内的代理创建 OpenShift Container Platform 集群,则集群范围的代理配置值会在满足以下条件时添加到 klusterlet add-ons 的 pod 中:

    • addon 部分中的 .spec.policyController.proxyPolicy 被启用并设置为 OCPGlobalProxy
    • .spec.applicationManager.proxyPolicy 被启用并设置为 CustomProxy

      注: addon 部分中的 proxyPolicy 默认值是 Disabled

      请参阅以下 proxyPolicy 条目示例:

      apiVersion: agent.open-cluster-management.io/v1
          kind: KlusterletAddonConfig
          metadata:
            name: clusterName
            namespace: clusterName
          spec:
            proxyConfig:
              httpProxy: http://pxuser:12345@10.0.81.15:3128
              httpsProxy: http://pxuser:12345@10.0.81.15:3128
              noProxy: .cluster.local,.svc,10.128.0.0/14, example.com
            applicationManager:
              enabled: true
              proxyPolicy: CustomProxy
            policyController:
              enabled: true
              proxyPolicy: OCPGlobalProxy
            searchCollector:
              enabled: true
              proxyPolicy: Disabled
            certPolicyController:
              enabled: true
              proxyPolicy: Disabled
            iamPolicyController:
              enabled: true
              proxyPolicy: Disabled

重要: 全局代理设置不会影响警报转发。要为使用集群范围代理的 Red Hat Advanced Cluster Management hub 集群设置警报转发,请参阅 转发警报 以了解更多详细信息。

法律通告

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.