I am using Grafana Cloud and have setup the Grafana Agent Operator in my kubernetes cluster, which is scraping pod logs and node metrics.
I am using traefik as an ingress controller with Prometheus metrics enabled.
How can I configure the Operator to collect the metrics from the traefik pods ?
If I undestand correctly, this documentation is not applicable because the Operator is managing the configmap: Configure scraping of application Pod metrics | Grafana Cloud documentation
Idealy, I would like to use the traefik integration to leverage its dashboards: Traefik integration for Grafana Cloud | Grafana Cloud documentation
Thanks
Following this Configure scraping of application Pod metrics | Grafana Cloud documentation and this Configure scraping of application Pod metrics | Grafana Cloud documentation documentation, I created this secret
apiVersion: v1
kind: Secret
metadata:
name: extra-jobs
namespace: grafana
stringData:
jobs.yaml: |
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
job_name: "kubernetes-pods"
kubernetes_sd_configs:
- role: pod
relabel_configs:
# Expose Pod labels as metric labels
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
# Expose Pod namespace as metric namespace label
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
# Expose Pod name as metric name label
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod
- action: hashmod
modulus: $(SHARDS)
source_labels:
- __address__
target_label: __tmp_hash
- action: keep
regex: $(SHARD)
source_labels:
- __tmp_hash
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
I edited the grafana-agent-metrics MetricsInstance to add this to the spec:
additionalScrapeConfigs:
name: extra-jobs
key: jobs.yaml
I then restarted everything in the operator namespace to make sure the changes are picked up and yet no metrics are sent to grafana cloud. I’m not seeing any errors in the agent logs nor in the operator logs, what am I doing wrong ?