learn-grafana/otel-collector.yaml
Waylon S. Walker 774ea44af1 wip
2025-05-23 10:24:41 -05:00

104 lines
2.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
namespace: meta
spec:
replicas: 1
selector:
matchLabels:
app: otel-collector
template:
metadata:
labels:
app: otel-collector
spec:
containers:
- name: otel-collector
image: otel/opentelemetry-collector:latest
args: ["--config=/etc/otel/otel-collector-config.yaml"]
volumeMounts:
- name: otel-config
mountPath: /etc/otel
ports:
- name: prom
containerPort: 8889
- name: grpc
containerPort: 4317
- name: http
containerPort: 4318
volumes:
- name: otel-config
configMap:
name: otel-collector-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-config
namespace: meta
data:
otel-collector-config.yaml: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlp:
endpoint: tempo:4317
tls:
insecure: true
prometheus:
endpoint: "0.0.0.0:8889"
service:
pipelines:
traces:
receivers: [otlp]
exporters: [otlp]
metrics:
receivers: [otlp]
exporters: [prometheus]
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
namespace: meta
labels:
release: kps # this MUST match the `release:` label used by your Prometheus install
app: otel-collector
spec:
ports:
- name: grpc
port: 4317
targetPort: 4317
- name: http
port: 4318
targetPort: 4318
- name: prom
port: 8889
targetPort: 8889
selector:
app: otel-collector
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: otel-collector
namespace: meta
labels:
release: kps # again, must match Prometheus's release label
spec:
selector:
matchLabels:
app: otel-collector
endpoints:
- port: prom
interval: 15s