datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Datadog agent doesn't scrape OpenMetrics of kubernetes-external-secrets controller

Open toshi0607 opened this issue 5 years ago • 4 comments

Please help me configure to scrape metrics from kubernetes-external-secrets controller.

Describe what happened:

I want to scrape prometheus metrics from a kubernetes-external-secretes controller, but it doesn't work.

metrics that I want to scrape

  • kubernetes_external_secrets_sync_calls_count
  • kubernetes_external_secrets_last_sync_call_state

from https://github.com/external-secrets/kubernetes-external-secrets#metrics

Describe what you expected:

Datadog agent collects metrics

Steps to reproduce the issue:

I set up the controller like this.

podAnnotations:
  ad.datadoghq.com/kubernetes-external-secrets.check_names: '["openmetrics"]'
  ad.datadoghq.com/kubernetes-external-secrets.init_configs: "[{}]"
  ad.datadoghq.com/kubernetes-external-secrets.instances: |
    [{
      "prometheus_url": "http://%%host%%:3001/metrics",
      "namespace": "external-secrets",
      "metrics": [
        "kubernetes_external_secrets_sync_calls_count",
        "kubernetes_external_secrets_last_sync_call_state",
      ]
    }]
$ kubectl get pod external-secrets-kubernetes-external-secrets-xxxxxx -o yaml
apiVersion: v1
kind: Pod
metadata:
  annotations:
    ad.datadoghq.com/kubernetes-external-secrets.check_names: '["openmetrics"]'
    ad.datadoghq.com/kubernetes-external-secrets.init_configs: '[{}]'
    ad.datadoghq.com/kubernetes-external-secrets.instances: |
      [{
        "prometheus_url": "http://%%host%%:3001/metrics",
        "namespace": "external-secrets",
        "metrics": [
          "kubernetes_external_secrets_sync_calls_count",
          "kubernetes_external_secrets_last_sync_call_state",
        ]
      }]
    kubernetes.io/psp: eks.privileged
...

spec:
  containers:
  - env:
...
    name: kubernetes-external-secrets
    ports:
    - containerPort: 3001
      name: prometheus
      protocol: TCP

In datadog agent pod, agent configcheck shows prometheus check, but it only includes namespace: datadog.cluster_agent, not external-secrets.

Additional environment details (Operating System, Cloud provider, etc):

  • Datadog runs on Amazon EKS
  • Agent 7.24.1 - Commit: cf2a7e6 - Serialization version: v4.46.0 - Go version: go1.14.7

toshi0607 avatar Mar 14 '21 09:03 toshi0607

Hi @toshi0607

Thanks for reaching out!

The configuration you shared seems good, although it seems that you have one extra comma in the metrics parameter: "kubernetes_external_secrets_last_sync_call_state",

Could you try to remove this extra comma and see if the agent picks up the annotations?

If this doesn't do the trick, please email our support team so they can investigate further with specific details from your environment.

Thank you!

Simwar avatar Mar 15 '21 16:03 Simwar

Hi @Simwar, really thank you for the suggestion. After removing the comma, datadog agent started to collect metrics and our dashboard shows the metrics at last 🎉

In this case, what is the best way to debug? I compared docs and configs, tried agent commands in datadog-agent pods, and kubectled the logs of the datadog-agent. Please tell me the way to detect config error directly like checking the specific log, etc if available!

toshi0607 avatar Mar 15 '21 23:03 toshi0607

This issue has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this issue is still relevant, adding a comment will keep it open. Also, you can always reopen the issue if you missed the window.

Thank you for your contributions!

dd-octo-sts avatar Oct 21 '25 10:10 dd-octo-sts

Hello, I'm closing this stale issue with no activity. Feel free to reopen it if you have any question. Thanks!

jacjtito avatar Feb 03 '26 19:02 jacjtito