Metrics unavailable in Prometheus without explicit Port declarations
Opened this issue · 2 comments
Jeansen commented
Tracee has metrics enabled by default, but relevant ports are not explicitly exposed so Prometheus could collect them. Only after I added
ports:
- name: metrics
containerPort: 3366
protocol: TCP
to the container stance in Tracee Daemonset, which now looks more like this then:
containers:
- name: tracee
image: docker.io/aquasec/tracee:0.20.0
command:
- /tracee/tracee
args:
- '--config'
- /tracee/config.yaml
ports:
- name: metrics
containerPort: 3366
protocol: TCP
...
Prometheus was able to see the metrics with the following PodMonitor:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: monitoring-tracee
namespace: default
labels:
name: monitoring-tracee
release: prometheus-grafana
spec:
namespaceSelector:
matchNames:
- tracee
podMetricsEndpoints:
- interval: 5s
port: metrics
selector:
matchLabels:
app.kubernetes.io/name: tracee