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

Add environmental variable to determine the agent's cluster name #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

musa-asad
Copy link
Collaborator

@musa-asad musa-asad commented Feb 7, 2025

Description of the issue

When running on a Kubernetes cluster, the only way the CloudWatch Agent can detect the cluster name is:

  1. If it's provided in the configuration:
"kubernetes": {
  "cluster_name": "<cluster-name>",
  "enhanced_container_insights": true
},
"application_signals": {
  "hosted_in": "<cluster-name>"
}
  1. By making a ec2:DescribeTags call.

Ideally, the agent should minimize external API calls, so we should implement a global way to retrieve the cluster name in case it isn't provided in the configuration. The Amazon CloudWatch Observability EKS add-on / Helm chart includes a .Values.clusterName, which can be passed in as an environmental variable for the agent's pod.

Description of changes

  • Add K8S_CLUSTER_NAME with cluster name from received from .Values.clusterName.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Screenshot 2025-02-02 at 11 32 40 PM

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@musa-asad musa-asad marked this pull request as ready for review February 24, 2025 03:20
@musa-asad musa-asad changed the title Add environmental variable to determine the agent's cluster name (#167) Add environmental variable to determine the agent's cluster name Feb 24, 2025
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.

1 participant