gpt4 book ai didi

Azure kubernetes - 多个托管身份?

转载 作者:行者123 更新时间:2023-12-02 11:41:59 25 4
gpt4 key购买 nike

我们计划在单个 Azure kubernetes 集群上部署多个应用程序,每个应用程序将拥有自己的一组 Azure 资源 - 例如: key 保管库、存储。

我计划为每个应用程序配置单独的托管身份并提供对相关资源的访问。

我知道 AZURE AAD POD 标识是配置 pod 以利用托管标识访问 Azure 资源的方法。

但是,如何将多个托管标识添加到 Azure kubernetes 集群中?这是执行权吗?

最佳答案

正如我之前提到的,我认为您不能向集群添加多个 MSI,您只能使用系统分配的 MSI 或用户分配的 MSI。

引用 - Use managed identities in Azure Kubernetes Service

就您而言,如果您想使用不同的服务主体进行身份验证(本质上 MSI 也是由 Azure 管理的服务主体),您可以创建多个 AD 应用程序以及服务主体。

引用 - How to: Use the portal to create an Azure AD application and service principal that can access resources

然后在每个应用程序的代码中,使用 ClientSecretCredential进行身份验证。

ClientSecretCredential credential1 = new ClientSecretCredentialBuilder()
.tenantId(tenantId)
.clientId(clientId)
.clientSecret(clientSecret)
.build();

然后使用凭据创建客户端,例如 secret 客户端。

SecretClient secretClient = new SecretClientBuilder()
.vaultUrl("<your-key-vault-url>")
.credential(credential1)
.buildClient();

关于Azure kubernetes - 多个托管身份?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63831662/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com