Giter Site home page Giter Site logo

Comments (14)

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

@hdj630 Same issue happens when running Cloudwatch agent on EKS Fargate. The metadata service isn't available so the agent decides that it is running On-prem and starts to look for credentials in .aws/credentials even though it has an IAM role attached via a serviceAccount. Running the same pod on EC2 with the same serviceAccount works fine.

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

I have pushed an image to thisisqasim/cloudwatch-agent that allows an env FORCE_MODE_EC2=True which forces it to use ec2 mode and not look for credentials at .aws/credetials

from amazon-cloudwatch-agent.

rs-garrick avatar rs-garrick commented on August 14, 2024

@ThisIsQasim That's great! Your behaviour should be the default.

But really, the config system of amazon-cloudwatch-agent is just bizarre. Why must it act differently than every other AWS client app? It's trying to be "smart" and just being inflexible. It should just use the auth defaults of the aws library and be done with it.

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

I think it’s being done to validate the config for EC2 specific features e.g. {instance_id}. It should however let the sdk handle the credentials chain and not manually handle it.

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

I have changed the flag for forcing EC2 mode from FORCE_MODE_EC2=True to RUN_IN_AWS=True as per instructions from the maintainers on #122

from amazon-cloudwatch-agent.

rs-garrick avatar rs-garrick commented on August 14, 2024

Just to be clear, your patch does not change the default behaviour, correct? Fargate instances will continue to be detected as OnPrem.

While I appreciate having a work-around, the patch seems strange to me. You've added an undocumented env var to fix behaviour that should be a straight-forward command-line option or automatic. Why not look at one of the existing variables like AWS_EXECUTION_ENV? It can be either AWS_ECS_FARGATE or AWS_ECS_EC2`

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

You are right in assuming this to be a workaround and not the ideal solution. Ideally, it should detect Fargate automatically without extra flags.

However, as per my limited knowledge, there is no metadata service of any kind on EKS Fargate nor are any AWS specific Env Vars injected. This makes it very difficult to automatically determine if the agent is running on EKS Fargate or OnPrem k8s. So the only solution, again as per my limited knowledge, was to add a flag that forces EC2 mode.

Fargate on ECS is different but I have never used it. Feel free to do it properly and make a PR. The maintainers sound like helpful people and I am sure they'll take up your contributions.

from amazon-cloudwatch-agent.

github-actions avatar github-actions commented on August 14, 2024

This issue was marked stale due to lack of activity.

from amazon-cloudwatch-agent.

jhnlsn avatar jhnlsn commented on August 14, 2024

I would like to revisit this issue and look at our credentials provider implementation. The default credentials provider for the aws sdk is able to handle being on Fargate vs k8s native cluster and move through different modes of credentials in order. I believe we can also take this approach with the agent.

from amazon-cloudwatch-agent.

github-actions avatar github-actions commented on August 14, 2024

This issue was marked stale due to lack of activity.

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

This is still a pending issue

from amazon-cloudwatch-agent.

github-actions avatar github-actions commented on August 14, 2024

This issue was marked stale due to lack of activity.

from amazon-cloudwatch-agent.

ThisIsQasim avatar ThisIsQasim commented on August 14, 2024

I believe this still needs attention

from amazon-cloudwatch-agent.

khanhntd avatar khanhntd commented on August 14, 2024

Hey @rs-garrick, this would be a short notice from me. However, would you able to build the image from source by using make dockerized-build and confirm this image works on your ECS Fargate. Moreover, for @ThisIsQasim, please help me in creating a separate issue even though its still addresses the same problem but on different platform. Thanks in advance for this

from amazon-cloudwatch-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.