elastic / apm-server

https://www.elastic.co/guide/en/apm/guide/current/index.html
Other
1.21k stars 518 forks source link

Kubernetes metadata enrichment #7161

Open axw opened 2 years ago

axw commented 2 years ago

When running instrumented applications within a Kuberentes environment, our agents will extract a limited amount of Kubernetes pod/node metadata from cgroup info: https://github.com/elastic/apm/blob/main/specs/agents/metadata.md#containerkubernetes-metadata

It may be useful to enrich this information with additional details that can only be obtained by communicating with the Kubernetes API Server, e.g. the Kubernetes service name, and labels/annotations.

Things to research:

axw commented 10 months ago

Another thing to consider would be to use a mutating admission controller to inject KUBERNETES_* environment variables. This could be a custom webhook, or it could be a published Kyverno mutate policy.