安装

目录

Overview

监控组件作为可观测性模块中监控、告警、巡检和健康检查功能的基础设施。本文档介绍如何在集群内安装 ACP Monitoring with Prometheus 插件或 ACP Monitoring with VictoriaMetrics 插件。

Installation Preparation

在安装监控组件前,请确保满足以下条件:

  • 已参考监控组件选择指南选择合适的监控组件。
  • 在业务集群中安装时,确保 global 集群可以访问业务集群的 11780 端口。
  • 若需使用存储类或持久卷存储监控数据,请提前在 Storage 部分创建相应资源。

Install the ACP Monitoring with Prometheus Plugin via console

Installation Procedures

  1. 进入 App Store Management > Cluster Plugins,选择目标集群。

  2. 找到 ACP Monitoring with Prometheus 插件,点击 Install

  3. 配置以下参数:

    参数说明
    Scale Configuration支持三种配置:Small ScaleMedium ScaleLarge Scale
    - 默认值基于平台推荐的负载测试值设置
    - 可根据实际集群规模选择或自定义配额
    - 默认值会随平台版本更新,固定配置建议自定义设置
    Storage Type- LocalVolume:本地存储,数据存放于指定节点
    - StorageClass:通过存储类自动生成持久卷
    - PV:使用已有持久卷
    注意:安装后不可修改存储配置
    Replica Count设置监控组件 Pod 数量
    注意:Prometheus 仅支持单节点安装
    Parameter Configuration可根据需要调整监控组件的数据参数
  4. 点击 Install 完成安装。

Access Method

安装完成后,可通过以下地址访问组件(<> 替换为实际值):

组件访问地址
Thanos<platform_access_address>/clusters/<cluster>/prometheus
Prometheus<platform_access_address>/clusters/<cluster>/prometheus-0
Alertmanager<platform_access_address>/clusters/<cluster>/alertmanager

Install the ACP Monitoring with Prometheus Plugin via YAML

1. Check available versions

确认插件已发布,可在 global 集群中检查 ModulePlugin 和 ModuleConfig 资源:


# kubectl get moduleplugin | grep prometheus 
prometheus                       30h
# kubectl get moduleconfig | grep prometheus
prometheus-v4.1.0                30h

表示集群中存在 ModulePlugin prometheus,且版本 v4.1.0 已发布。

2. Create a ModuleInfo

创建 ModuleInfo 资源以安装插件,示例无配置参数:

kind: ModuleInfo
apiVersion: cluster.alauda.io/v1alpha1
metadata:
  name: global-prometheus
  labels:
    cpaas.io/cluster-name: global
    cpaas.io/module-name: prometheus
    cpaas.io/module-type: plugin
spec:
  version: v4.1.0
  config:
    storage:
      type: LocalVolume
      capacity: 40
      nodes:
        - xxx.xxx.xxx.xx
      path: /cpaas/monitoring
      storageClass: ""
      pvSelectorK: ""
      pvSelectorV: ""
    replicas: 1
    components:
      prometheus:
        retention: 7
        scrapeInterval: 60
        scrapeTimeout: 45
        resources: null
      nodeExporter:
        port: 9100
        resources: null
      alertmanager:
        resources: null
      kubeStateExporter:
        resources: null
      prometheusAdapter:
        resources: null
      thanosQuery:
        resources: null
    size: Small

资源设置参考示例 prometheus:

spec:
  config:
    components:
      prometheus:
        resources:
          limits:
            cpu: 2000m
            memory: 2000Mi
          requests:
            cpu: 1000m
            memory: 1000Mi

更多详情请参考监控组件容量规划

YAML 字段参考(VictoriaMetrics):

字段路径说明
metadata.labels.cpaas.io/cluster-name插件安装的目标集群名称。
metadata.labels.cpaas.io/module-name必须为 victoriametrics
metadata.labels.cpaas.io/module-type必须为 plugin
metadata.nameModuleInfo 名称(如 <cluster>-victoriametrics)。
spec.version要安装的插件版本。
spec.config.storage.type存储类型:LocalVolumeStorageClassPV
spec.config.storage.capacityVictoriaMetrics 存储大小(Gi),建议至少 30 Gi。
spec.config.storage.nodesstorage.type=LocalVolume 时的节点列表,最多支持 1 个节点。
spec.config.storage.pathstorage.type=LocalVolume 时的本地路径。
spec.config.storage.storageClassstorage.type=StorageClass 时的存储类名称。
spec.config.storage.pvSelectorKstorage.type=PV 时的 PV 选择器键。
spec.config.storage.pvSelectorVstorage.type=PV 时的 PV 选择器值。
spec.replicas副本数;LocalVolume 不支持多副本。
spec.config.components.vmstorage.retentionvmstorage 的数据保留天数。
spec.config.components.vmagent.scrapeInterval抓取间隔秒数;适用于无 interval 的 ServiceMonitors。
spec.config.components.vmagent.scrapeTimeout抓取超时秒数,必须小于 scrapeInterval
spec.config.components.vmstorage.resourcesvmstorage 的资源配置。
spec.config.components.nodeExporter.portNode Exporter 端口(默认 9100)。
spec.config.components.nodeExporter.resourcesNode Exporter 的资源配置。
spec.config.components.alertmanager.resourcesAlertmanager 的资源配置。
spec.config.components.kubeStateExporter.resourcesKube State Exporter 的资源配置。
spec.config.components.prometheusAdapter.resourcesPrometheus Adapter 的资源配置。
spec.config.components.vmagent.resourcesvmagent 的资源配置。
spec.config.size监控规模:SmallMediumLarge

3. Verify installation

由于创建后 ModuleInfo 名称会变化,可通过标签定位资源,查看插件状态和版本:

kubectl get moduleinfo -l cpaas.io/module-name=victoriametrics
NAME                                             CLUSTER         MODULE            DISPLAY_NAME     STATUS    TARGET_VERSION   CURRENT_VERSION   NEW_VERSION
global-e671599464a5b1717732c5ba36079795          global          victoriametrics   victoriametrics  Running   v4.1.0           v4.1.0            v4.1.0

字段说明:

  • NAME:ModuleInfo 资源名称
  • CLUSTER:插件安装的集群
  • MODULE:插件名称
  • DISPLAY_NAME:插件显示名称
  • STATUS:安装状态,Running 表示安装成功且运行中
  • TARGET_VERSION:预期安装版本
  • CURRENT_VERSION:安装前版本
  • NEW_VERSION:可安装的最新版本

Install the ACP Monitoring with VictoriaMetrics Plugin via console

Prerequisites

  • 若仅安装 VictoriaMetrics agent,需确保 VictoriaMetrics Center 已在其他集群安装。

Installation Procedures

  1. 进入 App Store Management > Cluster Plugins,选择目标集群。

  2. 找到 ACP Monitoring with VictoriaMetrics 插件,点击 Install

  3. 配置以下参数:

    参数说明
    Scale Configuration支持三种配置:Small ScaleMedium ScaleLarge Scale
    - 默认值基于平台推荐的负载测试值设置
    - 可根据实际集群规模选择或自定义配额
    - 默认值会随平台版本更新,固定配置建议自定义设置
    Install Agent Only- 关闭:安装完整 VictoriaMetrics 组件套件
    - 开启:仅安装 VMAgent 采集组件,依赖 VictoriaMetrics Center
    VictoriaMetrics Center选择已安装完整 VictoriaMetrics 组件的集群
    Storage Type- LocalVolume:本地存储,数据存放于指定节点
    - StorageClass:通过存储类自动生成持久卷
    - PV:使用已有持久卷
    Replica Count设置监控组件 Pod 数量:
    - LocalVolume 存储类型不支持多副本
    - 其他存储类型请参考界面提示配置
    Parameter Configuration可调整监控组件的数据参数
    注意:数据可能会暂时超出保留期后再删除
  4. 点击 Install 完成安装。

Install the ACP Monitoring with VictoriaMetrics Plugin via YAML

1. Check available versions

确认插件已发布,可在 global 集群中检查 ModulePlugin 和 ModuleConfig 资源:


# kubectl get moduleplugin | grep victoriametrics    
victoriametrics                       30h
# kubectl get moduleconfig | grep victoriametrics
victoriametrics-v4.1.0                30h

表示集群中存在 ModulePlugin victoriametrics,且版本 v4.1.0 已发布。

2. Create a ModuleInfo

创建 ModuleInfo 资源以安装插件,示例无配置参数:

kind: ModuleInfo
apiVersion: cluster.alauda.io/v1alpha1
metadata:
  name: business-1-victoriametrics
  labels:
    cpaas.io/cluster-name: business-1
    cpaas.io/module-name: victoriametrics
    cpaas.io/module-type: plugin
spec:
  version: v4.1.0
  config:
    storage:
      type: LocalVolume
      capacity: 40
      nodes:
        - xxx.xxx.xxx.xx
      path: /cpaas/monitoring
      storageClass: ""
      pvSelectorK: ""
      pvSelectorV: ""
    replicas: 1
    agentOnly: false
    agentReplicas: 1
    crossClusterDependency:
      victoriametrics: ""
    components:
      nodeExporter:
        port: 9100
        resources: null
      vmstorage:
        retention: 7
        resources: null
      kubeStateExporter:
        resources: null
      vmalert:
        resources: null
      prometheusAdapter:
        resources: null
      vmagent:
        scrapeInterval: 60
        scrapeTimeout: 45
        resources: null
      vminsert:
        resources: null
      alertmanager:
        resources: null
      vmselect:
        resources: null
    size: Small

资源设置参考示例 prometheus:

spec:
  config:
    components:
      vmagent:
        resources:
          limits:
            cpu: 2000m
            memory: 2000Mi
          requests:
            cpu: 1000m
            memory: 1000Mi

更多详情请参考监控组件容量规划

YAML 字段参考(Prometheus):

字段路径说明
metadata.labels.cpaas.io/cluster-name插件安装的目标集群名称。
metadata.labels.cpaas.io/module-name必须为 prometheus
metadata.labels.cpaas.io/module-type必须为 plugin
metadata.nameModuleInfo 名称(如 <cluster>-prometheus)。
spec.version要安装的插件版本。
spec.config.storage.type存储类型:LocalVolumeStorageClassPV
spec.config.storage.capacityPrometheus 存储大小(Gi),建议至少 30 Gi。
spec.config.storage.nodesstorage.type=LocalVolume 时的节点列表,最多支持 1 个节点。
spec.config.storage.pathstorage.type=LocalVolume 时的本地路径。
spec.config.storage.storageClassstorage.type=StorageClass 时的存储类名称。
spec.config.storage.pvSelectorKstorage.type=PV 时的 PV 选择器键。
spec.config.storage.pvSelectorVstorage.type=PV 时的 PV 选择器值。
spec.replicas副本数,仅适用于 StorageClass/PV 类型。
spec.config.components.prometheus.retention数据保留天数。
spec.config.components.prometheus.scrapeInterval抓取间隔秒数;适用于无 interval 的 ServiceMonitors。
spec.config.components.prometheus.scrapeTimeout抓取超时秒数,必须小于 scrapeInterval
spec.config.components.prometheus.resourcesPrometheus 的资源配置。
spec.config.components.nodeExporter.portNode Exporter 端口(默认 9100)。
spec.config.components.nodeExporter.resourcesNode Exporter 的资源配置。
spec.config.components.alertmanager.resourcesAlertmanager 的资源配置。
spec.config.components.kubeStateExporter.resourcesKube State Exporter 的资源配置。
spec.config.components.prometheusAdapter.resourcesPrometheus Adapter 的资源配置。
spec.config.components.thanosQuery.resourcesThanos Query 的资源配置。
spec.config.size监控规模:SmallMediumLarge

3. Verify installation

由于创建后 ModuleInfo 名称会变化,可通过标签定位资源,查看插件状态和版本:

kubectl get moduleinfo -l cpaas.io/module-name=prometheus
NAME                                             CLUSTER         MODULE        DISPLAY_NAME   STATUS    TARGET_VERSION   CURRENT_VERSION   NEW_VERSION
global-e671599464a5b1717732c5ba36079795          global          prometheus    prometheus     Running   v4.1.0           v4.1.0            v4.1.0

字段说明:

  • NAME:ModuleInfo 资源名称
  • CLUSTER:插件安装的集群
  • MODULE:插件名称
  • DISPLAY_NAME:插件显示名称
  • STATUS:安装状态,Running 表示安装成功且运行中
  • TARGET_VERSION:预期安装版本
  • CURRENT_VERSION:安装前版本
  • NEW_VERSION:可安装的最新版本