×

接收器将数据传入 Collector。接收器可以是基于推送或拉取的。通常,接收器以指定的格式接受数据,将其转换为内部格式,然后将其传递给适用管道中定义的处理器和导出器。默认情况下,未配置任何接收器。必须配置一个或多个接收器。接收器可能支持一个或多个数据源。

OTLP 接收器

OTLP 接收器使用 OpenTelemetry 协议 (OTLP) 接收跟踪、指标和日志。OTLP 接收器使用 OpenTelemetry 协议 (OTLP) 接收跟踪和指标。

启用了 OTLP 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317 (1)
            tls: (2)
              ca_file: ca.pem
              cert_file: cert.pem
              key_file: key.pem
              client_ca_file: client.pem (3)
              reload_interval: 1h (4)
          http:
            endpoint: 0.0.0.0:4318 (5)
            tls: (6)

    service:
      pipelines:
        traces:
          receivers: [otlp]
        metrics:
          receivers: [otlp]
# ...
1 OTLP gRPC 端点。如果省略,则使用默认值 `0.0.0.0:4317`。
2 服务器端 TLS 配置。定义 TLS 证书的路径。如果省略,则禁用 TLS。
3 服务器验证客户端证书的 TLS 证书路径。这会将 `TLSConfig` 中的 `ClientCAs` 和 `ClientAuth` 值设置为 `RequireAndVerifyClientCert`。有关更多信息,请参阅 Golang TLS 包的 `Config`
4 指定重新加载证书的时间间隔。如果未设置该值,则永远不会重新加载证书。`reload_interval` 字段接受包含有效时间单位的字符串,例如 `ns`、`us`(或 `µs`)、`ms`、`s`、`m`、`h`。
5 OTLP HTTP 端点。默认值为 `0.0.0.0:4318`。
6 服务器端 TLS 配置。有关更多信息,请参阅 `grpc` 协议配置部分。

Jaeger 接收器

Jaeger 接收器以 Jaeger 格式接收跟踪。

启用了 Jaeger 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
      jaeger:
        protocols:
          grpc:
            endpoint: 0.0.0.0:14250 (1)
          thrift_http:
            endpoint: 0.0.0.0:14268 (2)
          thrift_compact:
            endpoint: 0.0.0.0:6831 (3)
          thrift_binary:
            endpoint: 0.0.0.0:6832 (4)
          tls: (5)

    service:
      pipelines:
        traces:
          receivers: [jaeger]
# ...
1 Jaeger gRPC 端点。如果省略,则使用默认值 `0.0.0.0:14250`。
2 Jaeger Thrift HTTP 端点。如果省略,则使用默认值 `0.0.0.0:14268`。
3 Jaeger Thrift Compact 端点。如果省略,则使用默认值 `0.0.0.0:6831`。
4 Jaeger Thrift Binary 端点。如果省略,则使用默认值 `0.0.0.0:6832`。
5 服务器端 TLS 配置。有关更多详细信息,请参阅 OTLP 接收器配置部分。

主机指标接收器

主机指标接收器以 OTLP 格式接收指标。

主机指标接收器仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 的支持,并且功能可能不完整。Red Hat 不建议在生产环境中使用它们。这些功能提供对即将推出的产品功能的抢先体验,使客户能够在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用了主机指标接收器的 OpenTelemetry Collector 自定义资源
apiVersion: v1
kind: ServiceAccount
metadata:
  name: otel-hostfs-daemonset
  namespace: <namespace>
# ...
---
apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
allowHostDirVolumePlugin: true
allowHostIPC: false
allowHostNetwork: false
allowHostPID: true
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: true
allowedCapabilities: null
defaultAddCapabilities:
- SYS_ADMIN
fsGroup:
  type: RunAsAny
groups: []
metadata:
  name: otel-hostmetrics
readOnlyRootFilesystem: true
runAsUser:
  type: RunAsAny
seLinuxContext:
  type: RunAsAny
supplementalGroups:
  type: RunAsAny
users:
- system:serviceaccount:<namespace>:otel-hostfs-daemonset
volumes:
- configMap
- emptyDir
- hostPath
- projected
# ...
---
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel
  namespace: <namespace>
spec:
  serviceAccount: otel-hostfs-daemonset
  mode: daemonset
  volumeMounts:
    - mountPath: /hostfs
      name: host
      readOnly: true
  volumes:
    - hostPath:
        path: /
      name: host
  config: |
    receivers:
      hostmetrics:
        collection_interval: 10s (1)
        initial_delay: 1s (2)
        root_path: / (3)
        scrapers: (4)
          cpu:
          memory:
          disk:
    service:
      pipelines:
        metrics:
          receivers: [hostmetrics]
# ...
1 设置主机指标收集的时间间隔。如果省略,则默认值为 `1m`。
2 设置主机指标收集的初始时间延迟。如果省略,则默认值为 `1s`。
3 配置 `root_path`,以便主机指标接收器知道根文件系统的位置。如果运行主机指标接收器的多个实例,请为每个实例设置相同的 `root_path` 值。
4 列出启用的主机指标收集器。可用的收集器是 `cpu`、`disk`、`load`、`filesystem`、`memory`、`network`、`paging`、`processes` 和 `process`。

Kubernetes 对象接收器

Kubernetes 对象接收器会拉取或监视要从 Kubernetes API 服务器收集的对象。此接收器主要监视 Kubernetes 事件,但它可以收集任何类型的 Kubernetes 对象。此接收器会收集整个集群的遥测数据,因此只有一个此接收器的实例就足以收集所有数据。

Kubernetes 对象接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 Kubernetes 对象接收器的 OpenTelemetry Collector 自定义资源
apiVersion: v1
kind: ServiceAccount
metadata:
  name: otel-k8sobj
  namespace: <namespace>
# ...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: otel-k8sobj
  namespace: <namespace>
rules:
- apiGroups:
  - ""
  resources:
  - events
  - pods
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - "events.k8s.io"
  resources:
  - events
  verbs:
  - watch
  - list
# ...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: otel-k8sobj
subjects:
  - kind: ServiceAccount
    name: otel-k8sobj
    namespace: <namespace>
roleRef:
  kind: ClusterRole
  name: otel-k8sobj
  apiGroup: rbac.authorization.k8s.io
# ...
---
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel-k8s-obj
  namespace: <namespace>
spec:
  serviceAccount: otel-k8sobj
  image: ghcr.io/os-observability/redhat-opentelemetry-collector/redhat-opentelemetry-collector:main
  mode: deployment
  config: |
    receivers:
      k8sobjects:
        auth_type: serviceAccount
        objects:
          - name: pods (1)
            mode: pull (2)
            interval: 30s (3)
            label_selector: (4)
            field_selector: (5)
            namespaces: [<namespace>,...] (6)
          - name: events
            mode: watch
    exporters:
      debug:
    service:
      pipelines:
        logs:
          receivers: [k8sobjects]
          exporters: [debug]
# ...
1 此接收器观察的资源名称:例如,podsdeploymentsevents
2 此接收器使用的观察模式:pullwatch
3 仅适用于拉取模式。拉取对象的请求间隔。如果省略,则默认值为 1h
4 定义目标的标签选择器。
5 筛选目标的字段选择器。
6 要从中收集事件的命名空间列表。如果省略,则默认值为 all

Kubelet 统计信息接收器

Kubelet 统计信息接收器从 kubelet 的 API 服务器提取与节点、Pod、容器和卷相关的指标。然后,这些指标将通过指标处理管道进行进一步分析。

Kubelet 统计信息接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 Kubelet 统计信息接收器的 OpenTelemetry Collector 自定义资源
# ...
config: |
  receivers:
    kubeletstats:
      collection_interval: 20s
      auth_type: "serviceAccount"
      endpoint: "https://${env:K8S_NODE_NAME}:10250"
      insecure_skip_verify: true
  service:
    pipelines:
      metrics:
        receivers: [kubeletstats]
env:
  - name: K8S_NODE_NAME (1)
    valueFrom:
      fieldRef:
        fieldPath: spec.nodeName
# ...
1 设置 K8S_NODE_NAME 以对 API 进行身份验证。

Kubelet 统计信息接收器需要用于运行 OpenTelemetry Collector 的服务帐户具有其他权限。

服务帐户所需的权限
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: otel-collector
rules:
  - apiGroups: ['']
    resources: ['nodes/stats']
    verbs: ['get', 'watch', 'list']
  - apiGroups: [""]
    resources: ["nodes/proxy"] (1)
    verbs: ["get"]
# ...
1 使用 extra_metadata_labelsrequest_utilizationlimit_utilization 指标时所需的权限。

Prometheus 接收器

Prometheus 接收器会抓取指标端点。

Prometheus 接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 Prometheus 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
        prometheus:
          config:
            scrape_configs: (1)
              - job_name: 'my-app'  (2)
                scrape_interval: 5s (3)
                static_configs:
                  - targets: ['my-app.example.svc.cluster.local:8888'] (4)
    service:
      pipelines:
        metrics:
          receivers: [prometheus]
# ...
1 使用 Prometheus 格式抓取配置。
2 Prometheus 作业名称。
3 抓取指标数据的间隔。接受时间单位。默认值为 1m
4 公开指标的目标。此示例从 example 项目中的 my-app 应用程序抓取指标。

OTLP JSON 文件接收器

OTLP JSON 文件接收器从包含 ProtoJSON 格式数据且符合 OpenTelemetry 协议 规范的文件中提取管道信息。接收器会监视指定目录中的更改(例如创建或修改的文件)以进行处理。

OTLP JSON 文件接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 OTLP JSON 文件接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    otlpjsonfile:
      include:
        - "/var/log/*.log" (1)
      exclude:
        - "/var/log/test.log" (2)
# ...
1 要监视的文件路径 glob 模式列表。
2 要忽略的文件路径 glob 模式列表。

Zipkin 接收器

Zipkin 接收器会接收 Zipkin v1 和 v2 格式的跟踪。

启用 Zipkin 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
      zipkin:
        endpoint: 0.0.0.0:9411 (1)
        tls: (2)
    service:
      pipelines:
        traces:
          receivers: [zipkin]
# ...
1 Zipkin HTTP 端点。如果省略,则使用默认值 0.0.0.0:9411
2 服务器端 TLS 配置。有关更多详细信息,请参阅 OTLP 接收器配置部分。

Kafka 接收器

Kafka 接收器以 OTLP 格式从 Kafka 接收跟踪、指标和日志。

Kafka 接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 Kafka 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
      kafka:
        brokers: ["localhost:9092"] (1)
        protocol_version: 2.0.0 (2)
        topic: otlp_spans (3)
        auth:
          plain_text: (4)
            username: example
            password: example
          tls: (5)
            ca_file: ca.pem
            cert_file: cert.pem
            key_file: key.pem
            insecure: false (6)
            server_name_override: kafka.example.corp (7)
    service:
      pipelines:
        traces:
          receivers: [kafka]
# ...
1 Kafka 代理列表。默认为 localhost:9092
2 Kafka 协议版本。例如,2.0.0。这是必填字段。
3 要从中读取的 Kafka 主题名称。默认为 otlp_spans
4 纯文本身份验证配置。如果省略,则禁用纯文本身份验证。
5 客户端 TLS 配置。定义 TLS 证书的路径。如果省略,则禁用 TLS 身份验证。
6 禁用验证服务器的证书链和主机名。默认为 false
7 ServerName 指示客户端请求的服务器名称,以支持虚拟主机。

Kubernetes 集群接收器

Kubernetes 集群接收器从 Kubernetes API 服务器收集集群指标和实体事件。它使用 Kubernetes API 来接收有关更新的信息。此接收器的身份验证仅通过服务帐户支持。

Kubernetes 集群接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用 Kubernetes 集群接收器的 OpenTelemetry Collector 自定义资源
# ...
  receivers:
    k8s_cluster:
      distribution: openshift
      collection_interval: 10s
  exporters:
    debug:
  service:
    pipelines:
      metrics:
        receivers: [k8s_cluster]
        exporters: [debug]
      logs/entity_events:
        receivers: [k8s_cluster]
        exporters: [debug]
# ...

此接收器需要配置的服务帐户、集群角色的 RBAC 规则以及将 RBAC 与服务帐户绑定的集群角色绑定。

ServiceAccount 对象
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app: otelcontribcol
  name: otelcontribcol
# ...
ClusterRole 对象的 RBAC 规则
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: otelcontribcol
  labels:
    app: otelcontribcol
rules:
- apiGroups:
  - quota.openshift.io
  resources:
  - clusterresourcequotas
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - events
  - namespaces
  - namespaces/status
  - nodes
  - nodes/spec
  - pods
  - pods/status
  - replicationcontrollers
  - replicationcontrollers/status
  - resourcequotas
  - services
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - daemonsets
  - deployments
  - replicasets
  - statefulsets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - extensions
  resources:
  - daemonsets
  - deployments
  - replicasets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - batch
  resources:
  - jobs
  - cronjobs
  verbs:
  - get
  - list
  - watch
- apiGroups:
    - autoscaling
  resources:
    - horizontalpodautoscalers
  verbs:
    - get
    - list
    - watch
# ...
ClusterRoleBinding 对象
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: otelcontribcol
  labels:
    app: otelcontribcol
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: otelcontribcol
subjects:
- kind: ServiceAccount
  name: otelcontribcol
  namespace: default
# ...

OpenCensus 接收器

OpenCensus 接收器提供与 OpenCensus 项目向后兼容的功能,以便更容易迁移已检测的代码库。它通过 gRPC 或 HTTP 和 Json 接收 OpenCensus 格式的指标和跟踪。

启用 OpenCensus 接收器的 OpenTelemetry Collector 自定义资源
# ...
  config: |
    receivers:
      opencensus:
        endpoint: 0.0.0.0:9411 (1)
        tls: (2)
        cors_allowed_origins: (3)
          - https://*.<example>.com
    service:
      pipelines:
        traces:
          receivers: [opencensus]
# ...
1 OpenCensus 端点。如果省略,则默认为 0.0.0.0:55678
2 服务器端 TLS 配置。有关更多详细信息,请参阅 OTLP 接收器配置部分。
3 您还可以使用 HTTP JSON 端点来可选配置 CORS,方法是在此字段中指定允许的 CORS 来源列表。* 通配符在 cors_allowed_origins 中被接受。要匹配任何来源,只需输入 *

文件日志接收器

文件日志接收器尾随并解析来自文件中的日志。

文件日志接收器目前仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前试用即将推出的产品功能,以便在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用尾随文本文件的 Filelog 接收器的 OpenTelemetry Collector 自定义资源
# ...
receivers:
  filelog:
    include: [ /simple.log ] (1)
    operators: (2)
      - type: regex_parser
        regex: '^(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (?P<sev>[A-Z]*) (?P<msg>.*)$'
        timestamp:
          parse_from: attributes.time
          layout: '%Y-%m-%d %H:%M:%S'
        severity:
          parse_from: attributes.sev
# ...
1 与要读取的文件路径匹配的文件 glob 模式列表。
2 运算符数组。每个运算符执行一项简单的任务,例如解析时间戳或 JSON。要将日志处理成所需的格式,请将运算符链接在一起。

Journald 接收器

Journald接收器解析来自**systemd**日志的**journald**事件并将其作为日志发送。

Journald接收器仅为技术预览功能。技术预览功能不受Red Hat生产服务级别协议(SLA)支持,并且可能功能不完整。Red Hat不建议在生产环境中使用它们。这些功能可让客户抢先体验即将推出的产品功能,从而能够在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

启用了Journald接收器的OpenTelemetry Collector自定义资源
apiVersion: v1
kind: Namespace
metadata:
  name: otel-journald
  labels:
    security.openshift.io/scc.podSecurityLabelSync: "false"
    pod-security.kubernetes.io/enforce: "privileged"
    pod-security.kubernetes.io/audit: "privileged"
    pod-security.kubernetes.io/warn: "privileged"
# ...
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: privileged-sa
  namespace: otel-journald
# ...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: otel-journald-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:openshift:scc:privileged
subjects:
- kind: ServiceAccount
  name: privileged-sa
  namespace: otel-journald
# ...
---
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel-journald-logs
  namespace: otel-journald
spec:
  mode: daemonset
  serviceAccount: privileged-sa
  securityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
      - CHOWN
      - DAC_OVERRIDE
      - FOWNER
      - FSETID
      - KILL
      - NET_BIND_SERVICE
      - SETGID
      - SETPCAP
      - SETUID
    readOnlyRootFilesystem: true
    seLinuxOptions:
      type: spc_t
    seccompProfile:
      type: RuntimeDefault
  config: |
    receivers:
      journald:
        files: /var/log/journal/*/*
        priority: info (1)
        units: (2)
          - kubelet
          - crio
          - init.scope
          - dnsmasq
        all: true (3)
        retry_on_failure:
          enabled: true (4)
          initial_interval: 1s (5)
          max_interval: 30s (6)
          max_elapsed_time: 5m (7)
    processors:
    exporters:
      debug:
        verbosity: detailed
    service:
      pipelines:
        logs:
          receivers: [journald]
          exporters: [debug]
  volumeMounts:
  - name: journal-logs
    mountPath: /var/log/journal/
    readOnly: true
  volumes:
  - name: journal-logs
    hostPath:
      path: /var/log/journal
  tolerations:
  - key: node-role.kubernetes.io/master
    operator: Exists
    effect: NoSchedule
# ...
1 按消息优先级或优先级范围过滤输出。默认值为info
2 列出要从中读取条目的单元。如果为空,则从所有单元读取条目。
3 包含很长的日志和包含不可打印字符的日志。默认值为false
4 如果设置为true,则接收器会在遇到下游组件的错误时暂停读取文件并尝试重新发送当前的日志批次。默认值为false
5 第一次失败后等待重试的时间间隔。默认值为1s。单位为mssmh
6 重试回退间隔的上限。达到此值后,连续重试尝试之间的时间间隔将保持在此值不变。默认值为30s。支持的单位为mssmh
7 尝试将日志批次发送到下游使用者时的最大时间间隔(包括重试尝试)。达到此值后,数据将被丢弃。如果设置值为0,则重试永不停止。默认值为5m。支持的单位为mssmh

Kubernetes事件接收器

Kubernetes事件接收器从Kubernetes API服务器收集事件。收集的事件被转换为日志。

Kubernetes事件接收器仅为技术预览功能。技术预览功能不受Red Hat生产服务级别协议(SLA)支持,并且可能功能不完整。Red Hat不建议在生产环境中使用它们。这些功能可让客户抢先体验即将推出的产品功能,从而能够在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

Kubernetes事件接收器所需的OpenShift Container Platform权限
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: otel-collector
  labels:
    app: otel-collector
rules:
- apiGroups:
  - ""
  resources:
  - events
  - namespaces
  - namespaces/status
  - nodes
  - nodes/spec
  - pods
  - pods/status
  - replicationcontrollers
  - replicationcontrollers/status
  - resourcequotas
  - services
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - daemonsets
  - deployments
  - replicasets
  - statefulsets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - extensions
  resources:
  - daemonsets
  - deployments
  - replicasets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - batch
  resources:
  - jobs
  - cronjobs
  verbs:
  - get
  - list
  - watch
- apiGroups:
    - autoscaling
  resources:
    - horizontalpodautoscalers
  verbs:
    - get
    - list
    - watch
# ...
启用了Kubernetes事件接收器的OpenTelemetry Collector自定义资源
# ...
  serviceAccount: otel-collector (1)
  config: |
    receivers:
      k8s_events:
        namespaces: [project1, project2] (2)
    service:
      pipelines:
        logs:
          receivers: [k8s_events]
# ...
1 拥有所需ClusterRole otel-collector RBAC的Collector的服务帐户。
2 要从中收集事件的命名空间列表。默认值为empty,这意味着收集所有命名空间。