azure - 尝试使用 kubectl 访问 azure aks 时出错

标签 azure azure-aks azure-cli

我浏览了此链接 - Error when attempting to access azure aks with kubectl其中谈到安装 kubectl 和 kubelogin,但我仍然找不到解决方法。

运行这些命令后,这基本上就是问题所在

az login
az account set --subscription
az aks get-credentials -n $AKS-cluster-name -g $resource-group-name

当我尝试使用 kubectl 时,这是我收到的错误

error: The azure auth plugin has been removed

我已尝试安装 kubectlkubelogin (如本论坛之前所述),但我仍然无法运行 kubectl get pods 或任何其他命令.

PS C:\Windows\system32> kubectl get pods
error: The azure auth plugin has been removed.
Please use the https://github.com/Azure/kubelogin kubectl/client-go credential plugin instead.
See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins for further details
PS C:\Windows\system32>

最佳答案

感谢@silent指导正确的方向。

正如@silent提到的,你必须使用az aks get-credentials -n $AKS-cluster-name -g $resource-group-name --admin以管理权限下载 Kubernetes 配置文件。

  • 配置文件将包含 Kubernetes 集群管理员的凭据,以便在集群上执行管理任务。
  • 没有--admin标志,配置文件将仅包含普通用户的凭据,这限制了您可以在集群上执行的任务。

我尝试过az aks get-credentials -n $AKS-cluster-name -g $resource-group-name --adminaz aks get-credentials -n $AKS-cluster-name -g $resource-group-name在我的环境中。它在两种情况下都有效,如下所示:

命令 1: enter image description here

命令 2: enter image description here

enter image description here

引用:

引用MSDOC有关“--admin”关键字的详细信息,因为它返回 AKS 集群的常规用户信用。

关于azure - 尝试使用 kubectl 访问 azure aks 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75938392/

相关文章:

azure - 无法通过自定义子域访问 CDN 端点

c# - 将现有 VS2013 网站解决方案迁移到云服务需要执行哪些步骤?

azure - 如果 kusto 中没有结果,则返回 null 而不是什么也不返回

azure - 无法从 Azure 容器应用程序中删除资源组

azure - 在 Azure AKS 中使用 Kubernetes Ingress 有哪些优势

azure - Azure 上正确的容器技术可实现长期运行的服务

使用 GraphQL 的 AKS 上的 Websockets 未连接

azure - 从 azure cli 创建服务主体

azure - 从快照恢复

java - 通过存储uri获取azure订阅id