You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[resourcedetection] Add api provider to eks detector (#40205)
#### Description
This is a replacement for this PR
#39981
- Expanded the resource attributes to be on par with the EC2 detector
(the new attributes are set to false by default)
#40061
- The EKS detector now uses the newly introduced EKS metadata provider
when the IMDS service is not available
- If IMDS Service is available, we use the EC2 metadata provider
This is needed for EKS clusters that don't have access to IMDS server
and causing the EC2 detector and the accountID/ClusterName attributes in
the EKS detector to fail.
#### Link to tracking issue
Fixes#39503
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests coverage
Manual deployment on EKS automode cluster
#### Documentation
In addition to the auto generated doc, I added new content to the
reamdme
Signed-off-by: Dani Louca <[email protected]>
Copy file name to clipboardExpand all lines: processor/resourcedetectionprocessor/README.md
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -319,6 +319,12 @@ processors:
319
319
320
320
### Amazon EKS
321
321
322
+
This detector reads resource information from the [EC2 instance metadata service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) to retrieve related resource attributes.
323
+
If IMDS is not available, (example: EKS-AutoMode and POD not on the hostnetwork), it falls back to a combination of [Kubernetes API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#-strong-kubernetes-api-v1-25-strong-)
324
+
and [EC2 API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html) to retrieve related resource attributes.
325
+
326
+
EC2 API requires the `EC2:DescribeInstances` permission to be granted to the IAM role. If IMDS is not accessible, ex: EKS-AutoMode, you can use [POD Identity](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html).
327
+
322
328
The list of the populated resource attributes can be found at [EKS Detector Resource Attributes](./internal/aws/eks/documentation.md).
323
329
324
330
Example:
@@ -351,6 +357,46 @@ processors:
351
357
Note: The kubernetes cluster name is only available when running on EC2 instances, and requires permission to run the `EC2:DescribeInstances` [action](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html).
352
358
If you see an error with the message `context deadline exceeded`, please increase the timeout setting in your config.
353
359
360
+
#### Node Name Env Variable
361
+
When using the EC2 API and the Kubernetes API to retrieve resource attributes, the node name is needed. The node name is extracted from the env variable you define on the pod.
362
+
The node name env variable that contains the node name value can be set using the `node_from_env_var` option:
363
+
364
+
```yaml
365
+
processors:
366
+
resourcedetection/eks:
367
+
detectors: [eks]
368
+
timeout: 15s
369
+
override: false
370
+
eks:
371
+
node_from_env_var: K8S_NODE_NAME
372
+
```
373
+
In this example, the env variable `K8S_NODE_NAME` will hold the actual node name and can be set in the pod spec using the downward API.
374
+
375
+
```yaml
376
+
env:
377
+
- name: K8S_NODE_NAME
378
+
valueFrom:
379
+
fieldRef:
380
+
fieldPath: spec.nodeName
381
+
```
382
+
383
+
#### IMDS client
384
+
These options are available to configure the IMDS client:
385
+
386
+
- `max_attempts`: The maximum number of attempts to make when calling the IMDS endpoint. The default is 3.
387
+
- `max_backoff`: The maximum backoff time to use when retrying a request. The default is 20 seconds.
388
+
389
+
```yaml
390
+
processors:
391
+
resourcedetection/eks:
392
+
detectors: [eks]
393
+
timeout: 15s
394
+
override: false
395
+
eks:
396
+
max_attempts: 10
397
+
max_backoff: 5m
398
+
```
399
+
354
400
### AWS Lambda
355
401
356
402
Uses the AWS Lambda [runtime environment variables](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime)
0 commit comments