0

目前,在集群创建时不可能在 arm 模板(和 terraform)上分配用户分配的身份。我已经尝试了很多东西,并且在手动插入后更新效果很好:

az aks pod-identity add --cluster-name my-aks-cn --resource-group myrg --namespace myns --name example-pod-identity --identity-resource-id /subscriptions/......

但是,我想通过部署立即完成此操作,因此我需要将 pod 用户身份自动插入集群。我还尝试使用 运行命令,DeploymentScripts但部署脚本尚未准备好使用preview aks extersion

我的配置如下所示:

    {
      "type": "Microsoft.ContainerService/managedClusters",
      "apiVersion": "2021-02-01",
      "name": "[variables('cluster_name')]",
      "location": "[variables('location')]",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet_name'))]"
      ],
      "properties": {
....
        "podIdentityProfile": {
        "allowNetworkPluginKubenet": null,
        "enabled": true,
        "userAssignedIdentities": [
            {
            "identity": {
                "clientId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managed-indentity'), '2018-11-30').clientId]",
                "objectId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managed-indentity'), '2018-11-30').principalId]",
                "resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'managed-indentity')]"
            },
            "name": "managed-indentity",
            "namespace": "myns"
            }
        ],
        "userAssignedIdentityExceptions": null
        },
....
      },
      "identity": {
        "type": "SystemAssigned"
      }
    },

我总是遇到同样的问题:

"statusMessage": "{\"error\":{\"code\":\"InvalidTemplateDeployment\",\"message\":\"The template deployment 'deployment_test' is not valid according to the validation procedure. The tracking id is '.....'. See inner errors for details.\",\"details\":[{\"code\":\"PodIdentityAddonUserAssignedIdentitiesNotAllowedInCreation\",\"message\":\"Provisioning of resource(s) for container service cluster-12344 in resource group myrc failed. Message: {\\n \\\"code\\\": \\\"PodIdentityAddonUserAssignedIdentitiesNotAllowedInCreation\\\",\\n \\\"message\\\": \\\"PodIdentity addon does not support assigning pod identities on creation.\\\"\\n }. Details: \"}]}}",

4

1 回答 1

0

产品团队在这里分享了答案:https ://github.com/Azure/aad-pod-identity/issues/1123

其中说:

这是现有配置中的已知限制。我们将在 V2 实现中解决这个问题。

对于其他面临相同问题的人,请参阅上面的 GitHub 问题。

于 2021-08-04T00:14:11.993 回答