如何对接外部 ES 存储集群

仅适用于较早版本

本指南介绍 Elasticsearch 存储插件的 elasticsearch.address / basicAuthSecretName 安装表单字段,此处保留这些内容作为 ACP 4.2 / 4.3 安装的参考资料,适用于仍在运行通过 chart 安装的 Elasticsearch 堆栈的环境。

ACP 4.4 完全不再提供 Elasticsearch 后端。 全新安装的 4.4 会通过两个 platform-default-* 连接 Secret 连接外部 ClickHouse 或 OpenSearch 以及外部 Kafka——外部对接是默认安装路径,而非可选项。请按照安装指南操作,并跳过本指南。从 ACP 4.3 的 Elasticsearch 升级的客户会在升级期间迁移到 ClickHouse 或 OpenSearch;请参阅升级指南。

您可以通过编写 YAML 配置对接外部 Elasticsearch 或 Kafka 集群。根据业务需求,您可以仅对接外部 Elasticsearch 集群(同时在当前集群中安装 Kafka),也可以同时对接外部 Elasticsearch 和 Kafka 集群。

TIP

对接外部 Elasticsearch 时支持的版本如下:

  • Elasticsearch 6.x 支持 6.6 - 6.8 版本;
  • Elasticsearch 7.x 支持 7.0 - 7.10.2 版本,建议使用 7.10.2。

资源准备

在进行对接之前,您需要准备所需的凭证信息。

  1. 在左侧导航栏中,点击集群管理 > 资源管理,然后切换到需要安装插件的集群。

  2. 点击创建资源对象,根据代码注释修改参数后,在代码框中填写内容。

  • 对接外部 Elasticsearch 所需的凭证:

    apiVersion: v1
    type: Opaque
    data:
      password: dEdWQVduSX5kUW1mc21acg==  # Must be base64 encoded. Reference command: echo -n <password_value>| base64
      username: YWRtaW4=                  # Must be base64 encoded. Reference command: echo -n <username_value>| base64
    kind: Secret
    metadata:
      name: elasticsearch-basic-auth      # Credential name. Ensure that the value of elasticsearch.basicAuthSecretName in the log storage YAML matches this parameter.
      namespace: cpaas-system             # The namespace where the Elasticsearch component is located, generally cpaas-system.
  • 如果需要使用外部 Kafka 集群,还需要创建用于对接外部 Kafka 集群的凭证:

    apiVersion: v1
    type: Opaque
    data:
      password: dEdWQVduSX5kUW1mc21acg==  # Must be base64 encoded. Reference command: echo -n <password_value>| base64
      username: YWRtaW4=                  # Must be base64 encoded. Reference command: echo -n <username_value>| base64
    kind: Secret
    metadata:
      name: kafka-basic-auth              # Credential name. Ensure that the value of kafka.basicAuthSecretName in the log storage YAML matches this parameter.
      namespace: cpaas-system             # The namespace where the Kafka component is located, generally cpaas-system.
  1. 点击创建。

操作步骤

  1. 在左侧导航栏中,点击 Marketplace > 集群插件。

  2. 在顶部导航栏中,选择要安装 Alauda Container Platform Log Storage for Elasticsearch 的 集群名称。

  3. 点击 Alauda Container Platform Log Storage for Elasticsearch 右侧的操作按钮,然后选择 安装。

  4. 启用 外部 Elasticsearch 开关,然后参考以下示例和参数说明配置 YAML 文件:

  • 在当前集群中安装 Kafka 时对接外部 Elasticsearch 集群:

    elasticsearch:
      install: false
      address: http://fake:9200                # External ES access address, e.g., http://192.168.143.252:11780/es_proxy
      basicAuthSecretName: elasticsearch-basic-auth # Credentials required for interfacing with external Elasticsearch created in the prerequisites.
    storageClassConfig:
      type: "LocalVolume"   # Default is LocalVolume. Options are "LocalVolume" or "StorageClass".
    kafka:
      auth: true                               # Whether to enable authentication.
      k8sNodes:
      - log1                                   # Node name, obtained from kubectl get nodes.
      - log2
      - log3
      storageSize: 10                          # Storage size, in Gi, default is 10 Gi.
  • 同时对接外部 Elasticsearch 集群和外部 Kafka 集群:

    elasticsearch:
      install: false
      address: http://fake:9200                # External ES access address, e.g., http://192.168.143.252:11780/es_proxy
      basicAuthSecretName: elasticsearch-basic-auth # Credentials required for interfacing with external Elasticsearch created in the prerequisites.
    kafka:
      auth: true                               # Whether to enable authentication.
      install: false
      basicAuthSecretName: kafka-basic-auth  # Credentials required for interfacing with external Kafka created in the prerequisites.
      address: 192.168.130.169:9092,192.168.130.187:9092,192.168.130.193:9092     # Kafka access addresses, separated by commas.