【问题标题】:az aks create - it used to create Service Principal now Managed Service Identityaz aks create - 它现在用于创建服务主体托管服务标识
【发布时间】:2021-02-11 04:01:34
【问题描述】:

更新:
一位在微软工作的同事说:

此行为更改的更改日志条目在这里:https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/docs-ref-conceptual/release-notes-azure-cli.md#aks-3


我正在按照正确的说明进行操作,并且文档必须已过期。

https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal

自动创建和使用服务主体。
在 Azure 门户中或使用 az aks create 命令创建 AKS 群集时,Azure 可以自动生成服务主体。 在以下 Azure CLI 示例中,未指定服务主体。在这种情况下,Azure CLI 为 AKS 群集创建服务主体。要成功完成该操作,您的 Azure 帐户必须具有创建服务主体的适当权限。

az aks create --name myAKSCluster --resource-group myResourceGroup

这是几个月前发生的事情 - 请参阅已完成服务主体创建

现在,当我尝试时,我得到 添加角色传播

问题是在 msi 中查询 servicePrincipalProfile.clientId 结果,我需要服务主体的 guid 而不是托管服务标识。

$CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)
echo $CLIENT_ID

曾经工作过:

现在变了:

如何按照文档所述创建具有服务主体的 Kubernetes 集群以及它过去是如何工作的?

复制步骤:

https://github.com/MeaningOfLights/AzureTraining/blob/master/Hands-On-Labs-That-Work/80-Kubernetes.md

https://github.com/MeaningOfLights/AzureTraining/blob/master/Hands-On-Labs-That-Work/85-Kubernetes-Deployment.md

【问题讨论】:

  • 你找到解决办法了吗?
  • @JeyJ 我使用kubeletidentity 让它工作了看答案

标签: azure kubernetes service-principal


【解决方案1】:

供参考:我得到了相同的结果,并按照您的link 发现这行得通。

az aks show -g aks -n cluster --query identityProfile.kubeletidentity.clientId -o tsv

这返回了适当的指南,我可以将其用于我的 RBAC 作业

# get the clientId of the cluster
$clientId = (az aks show -g aks -n cluster --query identityProfile.kubeletidentity.clientId -o tsv)

# get the resourceId of the registry
$acrId=(az acr show -g acr -n myacr --query id -o tsv)


# give authority for cluster id to the acr pull
az role assignment create $clientId --role AcrPull --scope $acrId

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-04
    • 2018-07-22
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多