我突然在使用 AKS 从 Azure 容器注册表中提取最新映像时遇到问题(之前工作正常。
If I run
kubectl describe pod <podid> I get:
Failed to pull image <image>: rpc error: code = Unknown desc = Error response from daemon: Get <image>: unauthorized: authentication required
我已尝试手动登录 ACR,一切正常 - 新图像已正确推送,我可以手动拉取它们。
此外我已经尝试过:
az aks update -g MyResourceGroup -n MyManagedCluster --attach-acr acrName
哪个成功(没有错误,输出传播成功),但它仍然不起作用。
我尝试使用以下方法更新凭据:
az aks update-credentials --resource-group <group>--name <aks name>--reset-service-principal --service-principal <sp id> --client-secret <client-secret>
其中输出了一条相当奇怪的消息:
Deployment failed. Correlation ID: 6e84754a-821d-4a39-a0df-7ab9ba21973f.
Unable to get log analytics workspace info. Resource ID:
/subscriptions/<subscription id>/resourcegroups/defaultresourcegroup-
weu/providers/microsoft.operationalinsights/workspaces/defaultworkspace-
d259e6ea-8230-4cb0-a7a8-7f0df6c7ef18-weu. Details: autorest/azure: Service
returned an error. Status=404 Code="ResourceGroupNotFound"
Message="Resource group 'defaultresourcegroup-weu' could not be found.". For
more details about how to create and use log analytics workspace, please
refer to: https://aka.ms/new-log-analytics
我尝试创建一个新的日志分析工作区,但上述错误仍然存在。
我还尝试过以下步骤:
这个链接 https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication#service-principal
这个帖子 https://stackoverflow.com/questions/49639280/kubernetes-cannot-pull-image-from-private-docker-image-repository
还有这个帖子 https://stackoverflow.com/questions/55574059/failed-to-pull-image-xx-azurecr-io-xxlatest-rpc-error-code-unknown-desc
除了上面的帖子之外,我还浏览了许多教程和 Microsoft 页面来尝试解决该问题。
我尝试创建一个新的服务主体并为其分配适当的角色,但错误仍然存在。
我也尝试过创造新的秘密,但没有成功。
我不需要新图像的 Pod 都按预期运行。
如果我查看我的应用程序注册(在天蓝色活动目录下),它们都是一年前创建的 - 所以我担心某些内容已过期,并且我不知道如何修复它。