64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
|
|
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
|