Kubernetes 和 OpenSearch 集成

强大的性能和简易的集成,由 Telegraf 提供支持,Telegraf 是 InfluxData 构建的开源数据连接器。

info

这不是大规模实时查询的推荐配置。 为了查询和压缩优化、高速摄取和高可用性,您可能需要考虑 Kubernetes 和 InfluxDB。

50 亿+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

10 亿+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将其视为时序数据时,任何数据都更有价值。借助 InfluxDB,这个 #1 的时序平台旨在通过 Telegraf 进行扩展。

查看入门方法

输入和输出集成概述

此插件通过与 Kubelet API 通信来捕获 Kubernetes Pod 和容器的指标。

OpenSearch 输出插件允许用户使用 HTTP 将指标直接发送到 OpenSearch 实例,从而促进 OpenSearch 生态系统内有效的数据管理和分析。

集成详情

Kubernetes

Kubernetes 输入插件与 Kubelet API 接口,以收集在单个主机上运行的 Pod 和容器的指标,理想情况下是 Kubernetes 安装中 DaemonSet 的一部分。 通过在集群内的每个节点上运行,它从本地运行的 Kubelet 收集指标,确保数据反映环境的实时状态。 作为一个快速发展的项目,Kubernetes 经常更新,此插件遵循主要云提供商支持的版本,在有限的时间跨度内保持跨多个版本的兼容性。 充分考虑了可能导致数据库负担过重的高序列基数; 因此,建议用户实施过滤技术和保留策略以有效管理此负载。 配置选项提供了插件行为的灵活定制,以便无缝集成到不同的设置中,从而增强其在监控 Kubernetes 环境中的实用性。

OpenSearch

OpenSearch Telegraf 插件通过 HTTP 与 OpenSearch 数据库集成,从而可以简化指标的收集和存储。 作为一个专为 2.x 及更高版本的 OpenSearch 版本设计的强大工具,该插件提供了强大的功能,同时通过原始 Elasticsearch 插件提供与 1.x 的兼容性。 此插件有助于在 OpenSearch 中创建和管理索引,自动管理模板并确保数据结构化以有效地进行分析。 该插件支持各种配置选项,例如索引名称、身份验证、运行状况检查和值处理,使其可以根据不同的操作要求进行定制。 它的功能使其对于希望利用 OpenSearch 的强大功能进行指标存储和查询的组织至关重要。

配置

Kubernetes

[[inputs.kubernetes]]
  ## URL for the kubelet, if empty read metrics from all nodes in the cluster
  url = "http://127.0.0.1:10255"

  ## Use bearer token for authorization. ('bearer_token' takes priority)
  ## If both of these are empty, we'll use the default serviceaccount:
  ## at: /var/run/secrets/kubernetes.io/serviceaccount/token
  ##
  ## To re-read the token at each interval, please use a file with the
  ## bearer_token option. If given a string, Telegraf will always use that
  ## token.
  # bearer_token = "/var/run/secrets/kubernetes.io/serviceaccount/token"
  ## OR
  # bearer_token_string = "abc_123"

  ## Kubernetes Node Metric Name
  ## The default Kubernetes node metric name (i.e. kubernetes_node) is the same
  ## for the kubernetes and kube_inventory plugins. To avoid conflicts, set this
  ## option to a different value.
  # node_metric_name = "kubernetes_node"

  ## Pod labels to be added as tags.  An empty array for both include and
  ## exclude will include all labels.
  # label_include = []
  # label_exclude = ["*"]

  ## Set response_timeout (default 5 seconds)
  # response_timeout = "5s"

  ## Optional TLS Config
  # tls_ca = /path/to/cafile
  # tls_cert = /path/to/certfile
  # tls_key = /path/to/keyfile
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

OpenSearch

[[outputs.opensearch]]
  ## URLs
  ## The full HTTP endpoint URL for your OpenSearch instance. Multiple URLs can
  ## be specified as part of the same cluster, but only one URLs is used to
  ## write during each interval.
  urls = ["http://node1.os.example.com:9200"]

  ## Index Name
  ## Target index name for metrics (OpenSearch will create if it not exists).
  ## This is a Golang template (see https://pkg.go.dev/text/template)
  ## You can also specify
  ## metric name (`{{.Name}}`), tag value (`{{.Tag "tag_name"}}`), field value (`{{.Field "field_name"}}`)
  ## If the tag does not exist, the default tag value will be empty string "".
  ## the timestamp (`{{.Time.Format "xxxxxxxxx"}}`).
  ## For example: "telegraf-{{.Time.Format \"2006-01-02\"}}-{{.Tag \"host\"}}" would set it to telegraf-2023-07-27-HostName
  index_name = ""

  ## Timeout
  ## OpenSearch client timeout
  # timeout = "5s"

  ## Sniffer
  ## Set to true to ask OpenSearch a list of all cluster nodes,
  ## thus it is not necessary to list all nodes in the urls config option
  # enable_sniffer = false

  ## GZIP Compression
  ## Set to true to enable gzip compression
  # enable_gzip = false

  ## Health Check Interval
  ## Set the interval to check if the OpenSearch nodes are available
  ## Setting to "0s" will disable the health check (not recommended in production)
  # health_check_interval = "10s"

  ## Set the timeout for periodic health checks.
  # health_check_timeout = "1s"
  ## HTTP basic authentication details.
  # username = ""
  # password = ""
  ## HTTP bearer token authentication details
  # auth_bearer_token = ""

  ## Optional TLS Config
  ## Set to true/false to enforce TLS being enabled/disabled. If not set,
  ## enable TLS only if any of the other options are specified.
  # tls_enable =
  ## Trusted root certificates for server
  # tls_ca = "/path/to/cafile"
  ## Used for TLS client certificate authentication
  # tls_cert = "/path/to/certfile"
  ## Used for TLS client certificate authentication
  # tls_key = "/path/to/keyfile"
  ## Send the specified TLS server name via SNI
  # tls_server_name = "kubernetes.example.com"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## Template Config
  ## Manage templates
  ## Set to true if you want telegraf to manage its index template.
  ## If enabled it will create a recommended index template for telegraf indexes
  # manage_template = true

  ## Template Name
  ## The template name used for telegraf indexes
  # template_name = "telegraf"

  ## Overwrite Templates
  ## Set to true if you want telegraf to overwrite an existing template
  # overwrite_template = false

  ## Document ID
  ## If set to true a unique ID hash will be sent as
  ## sha256(concat(timestamp,measurement,series-hash)) string. It will enable
  ## data resend and update metric points avoiding duplicated metrics with
  ## different id's
  # force_document_id = false

  ## Value Handling
  ## Specifies the handling of NaN and Inf values.
  ## This option can have the following values:
  ##    none    -- do not modify field-values (default); will produce an error
  ##               if NaNs or infs are encountered
  ##    drop    -- drop fields containing NaNs or infs
  ##    replace -- replace with the value in "float_replacement_value" (default: 0.0)
  ##               NaNs and inf will be replaced with the given number, -inf with the negative of that number
  # float_handling = "none"
  # float_replacement_value = 0.0

  ## Pipeline Config
  ## To use a ingest pipeline, set this to the name of the pipeline you want to use.
  # use_pipeline = "my_pipeline"

  ## Pipeline Name
  ## Additionally, you can specify a tag name using the notation (`{{.Tag "tag_name"}}`)
  ## which will be used as the pipeline name (e.g. "{{.Tag \"os_pipeline\"}}").
  ## If the tag does not exist, the default pipeline will be used as the pipeline.
  ## If no default pipeline is set, no pipeline is used for the metric.
  # default_pipeline = ""

输入和输出集成示例

Kubernetes

  1. 动态资源分配监控:通过利用 Kubernetes 插件,团队可以为跨各种 Pod 和容器的资源使用模式设置警报。 这种主动监控方法可以根据特定阈值自动扩展资源,从而有助于优化性能,同时最大限度地降低高峰使用期间的成本。

  2. 多租户资源隔离分析:使用 Kubernetes 的组织可以利用此插件来跟踪每个命名空间的资源消耗。 在多租户场景中,了解不同团队之间的资源分配和使用情况对于确保公平访问和性能保证至关重要,从而带来更好的资源管理策略。

  3. 实时运行状况仪表板:将 Kubernetes 插件捕获的数据集成到 Grafana 等可视化工具中,以创建实时仪表板。 这些仪表板提供对 Kubernetes 环境整体运行状况和性能的深入了解,使团队能够快速识别和纠正跨集群、Pod 和容器的问题。

  4. 自动化事件响应工作流程:通过将 Kubernetes 插件与警报管理系统相结合,团队可以根据实时指标自动化事件响应程序。 如果 Pod 的资源使用量超过预定义限制,则自动化工作流程可以触发补救措施,例如重启 Pod 或重新分配资源——所有这些都有助于提高系统弹性。

OpenSearch

  1. 时序数据的动态索引:利用 OpenSearch Telegraf 插件为时序指标动态创建索引,确保数据以有组织的方式存储,从而有利于基于时间的查询。 通过使用 Go 模板定义索引模式,用户可以利用该插件创建每日或每月索引,这可以大大简化数据管理和长期检索,从而提高分析性能。

  2. 多租户应用程序的集中日志记录:在多租户应用程序中实施 OpenSearch 插件,其中每个租户的日志都发送到单独的索引。 这可以在保持数据隔离的同时,对每个租户进行有针对性的分析和监控。 通过利用索引名称模板功能,用户可以自动创建特定于租户的索引,这不仅简化了流程,还提高了租户数据的安全性和可访问性。

  3. 与机器学习集成以进行异常检测:将 OpenSearch 插件与机器学习工具一起使用,以自动检测指标数据中的异常。 通过配置插件将实时指标发送到 OpenSearch,用户可以将机器学习模型应用于传入的数据流,以识别异常值或异常模式,从而促进主动监控和快速补救措施。

  4. 使用 OpenSearch 增强的监控仪表板:使用从 OpenSearch 收集的指标来创建实时仪表板,这些仪表板可以深入了解系统性能。 通过将指标馈送到 OpenSearch,组织可以利用 OpenSearch Dashboards 可视化关键绩效指标,使运营团队能够快速评估运行状况和性能,并做出数据驱动的决策。

反馈

感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将其视为时序数据时,任何数据都更有价值。借助 InfluxDB,这个 #1 的时序平台旨在通过 Telegraf 进行扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。 它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许根据这些消息创建指标。 它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流中读取指标。 它支持多种输入数据格式,并提供使用 DynamoDB 进行可靠消息处理的检查点功能。

查看集成