【问题标题】:td-agent does not validate google cloud service account credentialstd-agent 不验证谷歌云服务帐户凭据
【发布时间】:2021-08-18 22:31:20
【问题描述】:

尝试使用 td-agent 和 fluent-google-cloud 插件配置 fluentd 输出。插件和所有依赖项都已加载,但 fluentd 未输出到谷歌云日志,并且 td-agent 日志状态为 error="Unable to read the credential file specified by GOOGLE_APPLICATION_CREDENTIALS: file /home/$(whoami)/.config/gcloud/service_account_credentials.json does not exist"。 但是,当我转到文件路径时,该文件确实存在,并且 $GOOGLE_APPLICATION_CREDENTIALS 变量也设置为文件路径。我应该怎么做才能解决这个问题?

【问题讨论】:

    标签: gcloud fluentd td-agent


    【解决方案1】:

    假设错误和您都是正确的,我怀疑 (!) 您正在使用您的用户帐户 (== whoami) 并在代理运行时找到 /home/$(whoami)/.config/gcloud(在 systemctl 下?) 作为 root 并且在那里找到凭据文件(可能是/root/.config/gcloud

    如果您提供更多关于您所做的工作的详细信息会很有帮助,以便我们更好地了解该问题。

    【讨论】:

    • 凭证文件的路径是/home/$(whoami)/.config/gcloud,td-agent在systemctl下运行。但这应该没关系吧?
    • 不清楚你是如何运行代理的,因为你没有在你的问题中解释。如果代理在systemctl 下运行,那么它是以root 帐户而不是$(whoami) 运行的,因此它需要在不同的位置查找文件。如果代理正在运行,例如Compute Engine VM,您应该不会遇到此问题,因为 Application Default Credentials 会自动为您获取 VM 的凭据。
    • 然后可以在哪里存储和访问凭据?由于代理以 root 身份运行,它不应该能够查看任何主文件夹吗?它不在 Compute Engine 虚拟机上运行,​​这是在本地机器上运行。
    • 请看我的回答。它可能正在查看/root/.config/gcloud
    • 我已经尝试过了并将凭据放入根目录,但它仍然只是说Unable to read the credential file specified by GOOGLE_APPLICATION_CREDENTIALS: file /root/.config/gcloud/service_account_credentials.json does not exist"
    猜你喜欢
    • 1970-01-01
    • 2019-05-23
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    • 2018-07-25
    • 1970-01-01
    • 2019-05-15
    • 2017-11-19
    相关资源
    最近更新 更多