-
Notifications
You must be signed in to change notification settings - Fork 172
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
Agent Metrics Configuration #331
Comments
Thanks for opening this! It's definitely something we'd like have supported, as you can imagine. Since we don't yet have a way to expose a metrics-only endpoint on agent, we'll want to make sure the listener is only on localhost (as you mentioned in #329). And since there are a lot of options for the telemetry stanza, it probably needs to be controlled by a more flexible config annotation style, similar to the auth-config annotation if possible. |
This is a very high value add for me so I want to see how feasible a contribution here is. Given the previously abandoned PR I want to make sure I get the requirements right.
Using the Prometheus also seems to come with a lot of caveats around auth https://www.vaultproject.io/docs/configuration/telemetry#prometheus I was looking into this myself. Before, diving too deeply into it I was wondering if It looks like I would indeed need to redefine all the other stanzas including the auth stanzas. 😨 vault-k8s/agent-inject/agent/container_sidecar.go Lines 62 to 69 in bd9da8f
Normally the Agent reads its config from an environment variable built by all the annotations. So annotations for a telemetry stanza would be key.
|
^ @tvoran given your concern here, would it be OK to just contribute a way to configure a I think that would at least give folks the option to expose the metrics via some sort of proxy internal to the pod. I think the Some notes on the auth annotations:
|
Hey! I can't speak to the changes required to the K8S/Helm side of things, but we do have a metrics only option for listeners: https://developer.hashicorp.com/vault/docs/agent#listener-stanza In particular, this would solve the "ability to open a separate port for telemetry" issue, as there now is a way to expose a metrics only listener for Vault Agent. |
I think this was fixed by #413? But we still can't scrape the metrics from Prometheus because the agent only listens on localhost. So we would need another annotation (maybe listener "tcp" {
address = "0.0.0.0:8080"
role = "metrics_only"
} A workaround would be a simple nginx sidecar proxy, but that's not always possible if the pod is created by a controller that doesn't allow configuring additional containers. apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: |
events {}
http {
server {
listen 8201;
location /metrics {
proxy_pass http://127.0.0.1:8200/agent/v1/metrics?format=prometheus;
}
}
} |
Using - name: vault-agent-metrics-proxy
image: alpine/socat:1.8.0.0
command:
- socat
- TCP4-LISTEN:8201
- TCP4:127.0.0.1:8200
ports:
- containerPort: 8201
name: vault-metrics |
Is your feature request related to a problem? Please describe.
Now that Vault Agent metrics have been released in v1.10.0 (hashicorp/vault#13675), the injector needs a way to enable and configure them. There is a strong need for those using the Vault Injector in production to have insights on Vault authentication/ connection issues from the injected agent.
Describe the solution you'd like
A means to configure metrics on Vault Agent via Injector annotations and environment variables
Describe alternatives you've considered
The "vault.hashicorp.com/agent-configmap" annotation allows for mounting a custom Agent config in place of relying on annotations. Redesigning our existing pipeline to generate a unique configmap for each service's agent, just to enable metrics configuration, is less than ideal though.
The text was updated successfully, but these errors were encountered: