运行 一个 pod 作为服务帐户连接到具有集成安全性的数据库

Running a pod as a service account to connect to a database with Integrated Security

我在 Azure Kubernetes Service 上有一个 .NET Core 服务 运行 和一个 Linux Docker 图像。它需要连接到具有集成安全性的本地数据库。我的本地 AD 中的服务帐户之一可以访问此数据库。

我的问题是 - 是否可以 运行 特定服务帐户下的 pod,以便该服务可以连接到数据库? (我采用的另一种方法是使用 WindowsIdentity.RunImpersonated 模拟调用,但这需要 DLL "advapi32.dll",我找不到将其部署到 Linux 容器并使其成为 运行.)

如果您在集群中安装和实施 AAD Pod Identity components,则 Pod 可以 运行 具有 Azure Active Directory 服务帐户的权限。

您需要在集群中设置 AzureIdentityAzureIdentityBinding 资源,然后向将使用与服务帐户关联的权限的 pod 添加标签。

请注意,此方法依赖于针对用于访问 SQL 服务器的服务帐户授予的 managed identity or service principal associated with your cluster having the role "Managed Identity Operator"(服务帐户必须存在于 Azure Active Directory 中)。

我怀疑您可能要求 pods 具有仅存在于您本地 AD 中的 "group managed service account" 的身份。我认为 Linux 容器 (Recently, Windows nodes support GMSAs as a GA feature) 不支持此功能。