Skip to content

Feature Request: Add Namespace Filtering Support to k8sobserver Extension #39677

Closed
@Ygshvr

Description

@Ygshvr

Component(s)

extension/observer/k8sobserver

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

The k8sobserver extension in the OpenTelemetry Collector's receiver_creator is really useful in discovering Kubernetes resources such as pods, services, ingresses, and nodes. However, it currently lacks a built-in mechanism to filter these resources by namespace. Implementing namespace filtering would significantly enhance the flexibility and scalability of Kubernetes monitoring, especially in multi-tenant or large-scale environments.

Describe the solution you'd like

Introduce a namespaces configuration option within the k8sobserver extension. This would allow users to specify an array of namespaces to watch.
Example configuration

extensions:
  k8s_observer:
    auth_type: serviceAccount
    namespaces: [default, prod, staging]
    observe_pods: true
    observe_services: true
    observe_ingresses: true
    observe_nodes: false

receivers:
  receiver_creator:
    watch_observers: [k8s_observer]
    receivers:
      redis:
        rule: type == "port" && pod.name matches "redis"
        config:
          password: '`pod.labels["SECRET"]`'

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions