-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ec2 tags collection is broken when kube2iam is used #3174
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3174 +/- ##
==========================================
+ Coverage 54.39% 57.36% +2.96%
==========================================
Files 543 462 -81
Lines 39043 28796 -10247
==========================================
- Hits 21239 16519 -4720
+ Misses 16536 11165 -5371
+ Partials 1268 1112 -156
|
@truthbk please review |
7b0b465
to
13c16c9
Compare
13c16c9
to
3e6975b
Compare
@clamoriniere can you review? Thanks! |
This may actually depend on which instance type you are running on. On m5 and c5, you do not want the trailing /, but on other instance types you do. See this issue for more details (particularly this comment) uswitch/kiam#42 (comment) |
I wonder if you even need to manually fetch credentials at all. Normally, if you provide no credentials the AWS SDK will attempt to use the instance profile, and it does all this work behind the scenes. |
Hi @2rs2ts The issue linked is, I believe, about the URL: |
Tested on kube2iam. Working without the '/' in the curl. |
Thank you guys! |
While QA-ing this feature, I stumbled upon this known kube2iam issue about cold caches. This is an issue for the agent as our cloud provider autodetection algorithm has intentionally short timeouts, to avoid delaying too much the agent startup. To pre-fill the kube2iam cache, I had to add the following init container to the agent daemonset:
|
That intentionally short timeout causes a lot of issues for us and many others... perhaps it should be reconsidered. One really really common problem is that the metadata endpoint isn't available (often due to setups like kube2iam or kiam) and so the agent boots up with the ec2 hostname as the agent hostname, which of course causes all sorts of problems in the backend because hostnames are not unique so you get tons of no data alerts and other confusion. If the user knows they're deploying the agent to a cloud provider, autodetection only makes things harder for them. |
Thanks for the feedback @2rs2ts I'll add something to the backlog to make it configurable. I think it requires a different config for each hostname provider, as otherwise we'll wait for X seconds * Y hostname provider, Y being the amount of providers preceding the one that will succeed in the user's environment, and the EC2 provider is the second last one which would significantly slow down the hostname detection. Do you agree, or did you have another solution in mind? |
I think you probably just want to provide a config value for the cloud provider in general. If I say to the agent "you are in EC2" then it should do only EC2 things, not GCE things or anything else. Hopefully that makes sense! |
What does this PR do?
Fix ec2 tag collection when datadog agent is used in kubernetes with kube2iam.
Additional Notes
There is no need to add "/" after a IAM role when composing the url used to get AWS security credentials.
Please see these issues:
DataDog/datadog-agen#3173
jtblin/kube2iam#204