Add k8sattributes

This commit is contained in:
2025-11-19 19:58:42 +01:00
parent 4300527cf3
commit c8144fd3b2
2 changed files with 36 additions and 3 deletions

24
apps/otel/otel-rbac.yaml Normal file
View File

@@ -0,0 +1,24 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: otel-collector
rules:
- apiGroups: [""]
resources: ["pods", "namespaces", "nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets", "daemonsets", "replicasets"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: otel-collector
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: otel-collector
subjects:
- kind: ServiceAccount
name: otel-collector
namespace: otel

View File

@@ -54,6 +54,15 @@ spec:
send_batch_size: 2000
send_batch_max_size: 2000
timeout: 5s
k8sattributes:
extract:
metadata:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.start_time
- k8s.pod.uid
- k8s.deployment.name
- k8s.node.name
exporters:
debug:
@@ -90,13 +99,13 @@ spec:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
processors: [k8sattributes, memory_limiter, batch]
exporters: [clickhouse]
metrics:
receivers: [otlp] #[otlp, hostmetrics]
processors: [memory_limiter, batch]
processors: [k8sattributes, memory_limiter, batch]
exporters: [debug, clickhouse]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
processors: [k8sattributes, memory_limiter, batch]
exporters: [clickhouse]