Skip to content

k8sclusterreceiver: Fetch namespace scoped metrics from the Master API #9401

@harnitsignalfx

Description

@harnitsignalfx

Is your feature request related to a problem? Please describe.
The k8sclusterreceiver today is set to fetch metrics from the k8s master API at the cluster scope level. In cases where we'd like to deploy the otel-collector as a sidecar, there is no mechanism to fetch metrics scoped to the namespace level. E.g. The pod phases and pod restarts for the namespace the collector is deployed in as a sidecar.

Ideally, there is a sidecar deployment model for the collector where the k8sclusterreceiver and the kubeletstatsreceiver both fetch data only related to the pod they are deployed on. This will help immensely for developers who do not have access to leverage ClusterRoles and are restricted to a certain set of namespaces.

Describe the solution you'd like
The receiver should have a flag to restrict fetching data from the namespace it is deployed in.

Describe alternatives you've considered
I tried setting a namespace scoped Role for the serviceAccount on the k8sclusterreceiver. It unfortunately still hits the /api/v1/pods endpoint and I'd like to use the /api/v1/namespaces/<namespace-name>/pods endpoint.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions