GCP CloudSQL、IAM 和 Hasura

发布于 2025-01-14 21:39:06 字数 192 浏览 3 评论 0 原文

我正在 GKE 上推出 Hasura,我需要它通过 IAM 连接到 CloudSQL。

虽然大多数在线教程都描述了如何使用 k8s 密钥作为用户名和密码,但我希望 Hasura 通过 IAM 进行连接。这意味着没有密码。

制作 HASURA_GRAPHQL_DATABASE_URL 来实现这一目标的最佳方法是什么?

I'm rolling out Hasura on GKE, and I need for it to connect to CloudSQL via IAM.

While most of the tutorials online describe the use of k8s secrets for usernames and passwords, I would like for Hasura to connect via IAM. That means no passwords.

What's the best way to craft the HASURA_GRAPHQL_DATABASE_URL to make that happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

べ繥欢鉨o。 2025-01-21 21:39:07

所以最后是 postgres 的 paramspec 来救援。通过为 HASURA_GRAPHQL_DATABASE_URL 制作连接字符串,如下所示:

postgres://localhost:5432/[电子邮件受保护]

正如 @kurtisvg 建议的那样,我能够使用 workload-identity 和带有 cloudsql-proxy 的 sidecar 成功连接

So in the end it was postgres' paramspec to the rescue. By crafting the connection string as follows for the HASURA_GRAPHQL_DATABASE_URL:

postgres://localhost:5432/[email protected]

I was able connect successfully, with workload-identity and a sidecar with cloudsql-proxy as @kurtisvg suggested

仅一夜美梦 2025-01-21 21:39:06

我建议使用自动 IAM 数据库身份验证,使用 Cloud SQL Auth 代理。您可以按照从 GKE 连接说明进行操作,并且只需修改 sidecar 命令以使用 -enable_iam_login 而不是密码的秘密。

I'd suggest using automatic IAM database authentication, using the Cloud SQL Auth proxy. You can follow the Connect from GKE instructions, and just modify the sidecar command to use the -enable_iam_login instead of a secret for the password.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文