Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vault agent export container port for scape metrics through podmonitor #634

Open
Danny5487401 opened this issue May 10, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Danny5487401
Copy link

Danny5487401 commented May 10, 2024

Is your feature request related to a problem? Please describe.

there is some need to get metrics like vault.agent.auth.failure from vault agent sidecar

Describe the solution you'd like

expose a port for podmonitor to scrape metrics

Describe alternatives you've considered

add container ports in k8s yaml

Additional context
Add any other context or screenshots about the feature request here.

@Danny5487401 Danny5487401 added the enhancement New feature or request label May 10, 2024
@Danny5487401 Danny5487401 changed the title vault agent metrics through podmonitor vault agent export container port for scape metrics through podmonitor Jun 6, 2024
@LS80
Copy link
Contributor

LS80 commented Oct 15, 2024

A PodMonitor requires a port to be defined as a containerPort. You can add that with the existing annotations

vault.hashicorp.com/agent-telemetry-prometheus_retention_time: 2m
vault.hashicorp.com/agent-json-patch: '[{"op": "replace", "path": "/ports", "value": [{"containerPort": 8200, "name": "metrics"}]}]'
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: my-app
spec:
  jobLabel: app
  selector:
    matchLabels:
      app: my-app
  podMetricsEndpoints:
    - port: metrics
      params:
        format:
          - prometheus
      interval: 1m
      filterRunning: true

But Prometheus won't be able to connect as the Vault agent only listens on localhost. You could use a proxy sidecar as mentioned in #331 (comment).

Ideally we would have a single annotation to add all the required configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants