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

Expose Kubernetes resource namespace metadata in discovery.kubernetes component #1550

Open
TheoBrigitte opened this issue Aug 26, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@TheoBrigitte
Copy link
Contributor

Request

I would like to be able to use the resource namespace's label in discovery.relabel to filter targets discovered by discovery.kubernetes.

Example:

        discovery.kubernetes "kubernetes_pods" {
          role = "pod"

          attach_metadata {
            namespace = true
          }
        }

        discovery.relabel "kubernetes_pods" {
          targets = discovery.kubernetes.kubernetes_pods.targets

          rule {
            source_labels = ["__meta_kubernetes_namespace_label_foo"]
            regex = "bar"
          }
        }

I expect the above configuration to select all Pods which from every namespace which have the label foo=bar set.

Use case

I am aware of the loki.source.podlogs component which would allow to select pods using a namespace label selector, but I would like to avoid the overhead of tailing logs via the Kubernetes API server, this is because I operate a large solution with multiple cluster running over 3000 pods.

@mattdurham
Copy link
Collaborator

This would require something similar to #1541 to alloy merging metadata labels to file based discovery.

@TheoBrigitte
Copy link
Contributor Author

Well AFAIU this would not solve my case. join would allow to enrich targets with additional labels, but yet there would be no way to pass the resulting receiver capsule to loki.source.file as it only accepts targets as arguments.

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

5 participants
@mattdurham @TheoBrigitte and others