Hi, Community.
I have some questions about configuration Grafana Beyla to instrument application using k8s_namespace.
I know how to config k8s_namespace but in my Kube cluster have namespaces more than 50 namespace and I cannot use regex to match all of project because it has different format.
So, my question is If I want to instrument app in
- Namespace 1
- Namespace 2
- Namespace 3
- Namespace 4
.
.
.
- Namespace 50
But I don’t want instrument app in Namespace 22, Namespace 40, and Namespace 50.
How can I config Beyla to support that case?
Thanks
I don’t believe that you can select namespaces to instrument. But you can filter, which traces, metrics you want to export:
1 Like
That’s mean I should instrument all namespaces and using Filter to filter application to filter metrics and traces from which app I don’t expect to export, right?
Yes, because that Beyla “instrumentation” is on deeper network kernel level, where there is no context about k8s namespace anyway:
So Beyla needs K8s decorator to add/discover K8S metadata.
1 Like
In Beyla Config have service discovery And In document said “This selector property will limit the instrumentation to the applications running in the Kubernetes Namespaces with a name matching the provided regular expression” So, That make me think I can instrument specific k8s_namespace.
Beyla configuration options | Grafana Beyla documentation
That sounds promising. Does it work?
Yes, it works.
Example:
discovery:
services:
- k8s_namespace: "some_ns|some_another_ns"
would match only processes running in those two namespaces.
You are right that Beyla instruments them on the kernel level, but what’s stops it from selecting those based on some discovery criteria?
The question is then, how to exclude some namespaces properly.