8.2.4. 导入集群


通过完成以下步骤之一导入集群:

  • 要使用自动导入,您必须创建一个包含要导入的集群的服务器和令牌对的 secret。

    1. 创建包含类似以下模板的内容的 YAML 文件:

      apiVersion: v1
      kind: Secret
      metadata:
        name: auto-import-secret
        namespace: <cluster_name>
      stringData:
        autoImportRetry: 5
        # If you are using the kubeconfig file, add the following value for the kubeconfig file
        # that has the current context set to the cluster to import:
        kubeconfig: |- <kubeconfig_file>
        # If you are using the token/server pair, add the following two values:
        token: <Token to access the cluster>
        server: <cluster_api_url>
      type: Opaque
      Copy to Clipboard Toggle word wrap
    2. 将文件保存为 auto-import-secret.yaml
    3. 使用以下命令应用 YAML 文件:

      oc apply -f auto-import-secret.yaml
      Copy to Clipboard Toggle word wrap
  • 要使用手动导入过程,请完成以下步骤:

    1. 使用以下 YAML 示例编辑示例 ManagedCluster 集群:

      apiVersion: cluster.open-cluster-management.io/v1
      kind: ManagedCluster
      metadata:
        name: <cluster_name>
        labels:
          cloud: auto-detect
          vendor: auto-detect
      spec:
        hubAcceptsClient: true
      Copy to Clipboard Toggle word wrap

      cloudvendor 的值被设置为 auto-detect 时,Red Hat Advanced Cluster Management 会检测您要导入的集群的云和厂商类型。您可以选择将 auto-detect 的值替换为集群的 cloud 和 vendor 值。请参见以下示例:

      cloud: Amazon
      vendor: OpenShift
      Copy to Clipboard Toggle word wrap
    2. 将文件保存为 managed-cluster.yaml
    3. 使用以下命令应用 YAML 文件:

      oc apply -f managed-cluster.yaml
      Copy to Clipboard Toggle word wrap

继续导入 klusterlet

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat