open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
701 stars 584 forks source link

Provide documentation on prerequisites for AwsEksResourceDetector #1384

Open lorchda opened 1 year ago

lorchda commented 1 year ago

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.

Is your feature request related to a problem?

Problem: Have to read the source code for AwsEksResourceDetector to understand which permissions and resources are needed in the cluster for it to work.

Describe the solution you'd like

Solution: Provide documentation on prerequisites.

First prerequisite: permissions for service account role

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: otel-awseksresourcedetector-role
rules:
  - apiGroups:
      - ""
    resources:
      - configmaps
    resourceNames:
      - aws-auth
      - cluster-info
    verbs:
      - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: otel-awseksresourcedetector-role-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: otel-awseksresourcedetector-role
subjects:
  - kind: ServiceAccount
    name: {{your_service_account}}
    namespace: {{namespace_of_your_service_account}}
  - kind: ServiceAccount
    name: {{your_service_account}}
    namespace: {{namespace_of_your_service_account}}

Second prerequisite: a configmap cluster-info in amazon-cloudwatch is required with the following information:

# create configmap for cluster name and aws region for CloudWatch Logs
# need to replace the placeholders {{cluster_name}} and {{region_name}}
apiVersion: v1
data:
  cluster.name: {{cluster_name}}
  logs.region: {{region_name}}
kind: ConfigMap
metadata:
  name: cluster-info
  namespace: amazon-cloudwatch
rehanpfmr commented 1 year ago

@lorchda @srikanthccv Let me add documentation for this