Files
Work-configuration-file/OpenTelemetry/Collector/02-otel-collector-ConfigMap.yaml
2026-01-19 22:08:33 +08:00

64 lines
1.6 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-config
namespace: monitoring
data:
config.yaml: |
# 全局配置
receivers:
# 1. 节点级指标采集仅DaemonSet生效
hostmetrics:
collection_interval: 30s
scrapers:
cpu: {}
memory: {}
disk: {}
filesystem: {}
network: {}
load: {}
processes: {}
# 2. 容器级指标采集仅DaemonSet生效修复kubeletstats配置
kubeletstats:
collection_interval: 30s
auth_type: "serviceAccount"
endpoint: "https://${K8S_NODE_NAME}:10250"
insecure_skip_verify: true
# 3. OTLP接收器DaemonSet/Deployment都生效
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch: {}
resource:
attributes:
- key: k8s.cluster.name
value: test-k8s
action: insert
- key: k8s.node.name
from_attribute: host.name
action: insert
exporters:
prometheusremotewrite:
endpoint: "http://10.0.0.38:9090/api/v1/write"
external_labels:
k8s_cluster: test-k8s
# 核心修复service配置
service:
pipelines:
metrics:
receivers: [hostmetrics, kubeletstats, otlp]
processors: [batch, resource]
exporters: [prometheusremotewrite]
telemetry:
logs:
level: info
metrics:
endpoint: 0.0.0.0:8888
collection_interval: 60s