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

Automate the creation of the permissions needed by k8sattributes. #2396

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

iblancasa
Copy link
Contributor

Description:
Continuation of #2394.

Link to tracking Issue: #2395

@iblancasa iblancasa marked this pull request as ready for review January 11, 2024 16:40
@iblancasa iblancasa requested a review from a team January 11, 2024 16:40
return parserNameK8sAttributes
}

func (o *K8sAttributesParser) GetRBACRules() []rbacv1.PolicyRule {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When extracting metadatas from node, the processor needs get, watch and list permissions for nodes resources.

I believe this situation still needs addressed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I didn´t see that.

Signed-off-by: Israel Blancas <[email protected]>
Signed-off-by: Israel Blancas <[email protected]>
@pavolloffay pavolloffay merged commit 38df36d into open-telemetry:main Jan 12, 2024
27 checks passed
@iblancasa iblancasa deleted the task/2395 branch January 12, 2024 11:04
@krishnapomar
Copy link

krishnapomar commented Mar 15, 2024

@pavolloffay, @TylerHelmuth

With the latest helm charts I am still facing this issue. I've tried creating explicit RBAC roles but still no luck. The collector keeps failing with this error: "E0315 20:53:15.417043 1 reflector.go:147] k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.Pod: failed to list *v1.Pod: pods is forbidden: User "system:serviceaccount:default:otel-collector-collector" cannot list resource "pods" in API group "" at the cluster scope".

I could see only the 'k8s.pod.ip' tag alone in the traces but not other k8s metadata. Could you please help me here and let me know if I am missing something, thank you.

Following are my config files, FYI I am using mode as Deployment.


Kustomisation file



apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:

  • collector-config.yaml
    helmCharts:
  • name: opentelemetry-operator
    repo: https://open-telemetry.github.io/opentelemetry-helm-charts
    version: "0.49.0"
    releaseName: otel-operator
    namespace: default
    includeCRDs: true
    valuesInline:
    mode: deployment
    admissionWebhooks:
    failurePolicy: Ignore
    certManager:
    enabled: false
    autoGenerateCert:
    enabled: true
    recreate: false
    presets:
    kubernetesAttributes:
    enabled: true
    serviceAccount:
    create: true
    clusterRole:
    create: true

Following is my collector-config.yaml file:


apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: otel-collector
spec:
mode: deployment
env:

  • name: HONEYCOMB_API_KEY
    value: actual_key
    config: |
    receivers:
    otlp:
    protocols:
    http:
    endpoint: "0.0.0.0:4318"
    grpc:
    endpoint: "0.0.0.0:4317"
    exporters:
    logging:
    verbosity: detailed
    otlp:
    endpoint: "api.honeycomb.io:443"
    headers:
    "x-honeycomb-team" : "${env:HONEYCOMB_API_KEY}"
    processors:
    batch:
    k8sattributes:
    auth_type: 'serviceAccount'
    extract:
    metadata:
    - k8s.pod.name
    - k8s.pod.uid
    - k8s.deployment.name
    - k8s.namespace.name
    - k8s.node.name
    - k8s.pod.start_time
    annotations:
    - tag_name: a1
    key: annotation-one
    from: pod
    - tag_name: a2
    key: annotation-two
    regex: field=(?P.+)
    from: namespace
    labels:
    - tag_name: l1
    key: label1
    from: namespace
    - tag_name: l2
    key: label2
    regex: field=(?P.+)
    from: pod
    pod_association:
    - sources:
    - from: resource_attribute
    name: k8s.pod.ip
    - sources:
    - from: resource_attribute
    name: k8s.pod.uid
    - sources:
    - from: connection
    service:
    pipelines:
    traces:
    receivers: [otlp]
    processors: [k8sattributes, batch]
    exporters: [otlp]

@iblancasa
Copy link
Contributor Author

@pavolloffay, @TylerHelmuth

With the latest helm charts I am still facing this issue. I've tried creating explicit RBAC roles but still no luck

#2525 removed the permissions the operator needs to create the RBAC for the processors. You need to add them.

@krishnapomar
Copy link

Thanks for confirming @iblancasa, will create them and see if that solves my problem.

ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…en-telemetry#2396)

* Automate the creation of the RBAC resources for the k8sattributes processor

Signed-off-by: Israel Blancas <[email protected]>

* Add missing permission

Signed-off-by: Israel Blancas <[email protected]>

* Add missing changelog

Signed-off-by: Israel Blancas <[email protected]>

---------

Signed-off-by: Israel Blancas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants