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

Automatic RBAC support for kubeletstats receiver and k8sobserver extension #3155

Closed
grandwizard28 opened this issue Jul 22, 2024 · 5 comments · Fixed by #3388
Closed

Automatic RBAC support for kubeletstats receiver and k8sobserver extension #3155

grandwizard28 opened this issue Jul 22, 2024 · 5 comments · Fixed by #3388
Assignees
Labels
area:collector Issues for deploying collector area:rbac Issues relating to RBAC enhancement New feature or request good first issue Good for newcomers

Comments

@grandwizard28
Copy link

Component(s)

collector

Describe the issue you're reporting

There seems to be missing rbac permissions for the collector when trying to use receivers which query the K8s API.
There have been 2 instances which I have noticed:

  1. The k8sobserver extension does not get the required rbac permissions. If I add the k8sattributes processor, then the permissions seem to be added.
  2. The kubeletstats receiver is throwing a 403 forbidden when trying to query node metrics:
kubelet request GET https://xxxxxxx:10250/stats/summary failed - \"403 Forbidden\", response: \"Forbidden (user=system:serviceaccount:observability:<name-of-collector>, verb=get, resource=nodes, subresource=stats)\"", "scraper": "kubeletstats"

Expectation

The operator should automatically add permissions for the extensions/receivers to work. If not, what is the recommended method to add additional permissions to the collector?

Setup

Running a bunch of collectors as dameonset managed by the operator

@jaronoff97
Copy link
Contributor

We don't yet support automatic RBAC for the kubelet stats receiver so for now you'll need to follow the steps in the kubelet stats documentation. That being said, this is definitely something we could/should do, i'll add it to our backlog :)

@jaronoff97 jaronoff97 added enhancement New feature or request good first issue Good for newcomers area:collector Issues for deploying collector and removed needs triage labels Jul 22, 2024
@jaronoff97 jaronoff97 changed the title Missing RBAC permissions in receivers and extensions Automatic RBAC support for kubeletstats receiver Jul 22, 2024
@grandwizard28
Copy link
Author

grandwizard28 commented Jul 22, 2024

I mentioned the k8sobserver extension also in this ticket. How would we go about that?

Do you want me to create a separate ticket for the extension?

@jaronoff97
Copy link
Contributor

Maybe just change this issue's title to include it, thank you.

@grandwizard28 grandwizard28 changed the title Automatic RBAC support for kubeletstats receiver Automatic RBAC support for kubeletstats receiver and k8sobserver extension Jul 22, 2024
@jaronoff97 jaronoff97 added the area:rbac Issues relating to RBAC label Aug 1, 2024
@rogercoll
Copy link

This would be really helpful and it will align with the kubelet preset of the collector's Helm Chart: https://github.com/open-telemetry/opentelemetry-helm-charts/tree/main/charts/opentelemetry-collector#configuration-for-retrieving-kubelet-metrics

I would suggest taking into account the optional node metrics of the kubeletstats receiver, if they are enabled by the user (e.g. kubeletstats::metrics::k8s.pod.memory.node.utilization::enabled: true), additional node permissions are required:

  rules:
    - apiGroups:
        - ""
      resources:
        - nodes/proxy
      verbs:
        - get
    - apiGroups:
        - ""
      resources:
        - nodes
      verbs:
        - get
        - watch
        - list

@iblancasa
Copy link
Contributor

I'll work on this as soon as #3206 is merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector area:rbac Issues relating to RBAC enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants