使用“ kubeconfig”选项时,单击“验证连接”时出现错误
Error: TFS.WebApi.Exception: No user credentials found for cluster in KubeConfig content. Make sure that the credentials exist and try again.
我粘贴并从中选择正确上下文的kubeconfig是〜/ .kube。/ config文件中内容的直接复制粘贴,使用w / kubectl可以正常工作
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: xxxxx
server: https://aks-my-stage-cluster-xxxxx.hcp.eastus.azmk8s.io:443
name: aks-my-stage-cluster-xxxxx
contexts:
- context:
cluster: aks-my-stage-cluster-xxxxx
user: clusterUser_aks-my-stage-cluster-xxxxx_aks-my-stage-cluster-xxxxx
name: aks-my-stage-cluster-xxxxx
current-context: aks-my-stage-cluster-xxxxx
kind: Config
preferences: {}
users:
- name: clusterUser_aks-my-stage-cluster-xxxxx_aks-my-stage-cluster-xxxxx
user:
auth-provider:
config:
access-token: xxxxx.xxx.xx-xx-xx-xx-xx
apiserver-id: xxxx
client-id: xxxxx
environment: AzurePublicCloud
expires-in: "3599"
expires-on: "1572377338"
refresh-token: xxxx
tenant-id: xxxxx
name: azure
答案 0 :(得分:0)
您可以尝试运行以下命令来获取KubeConfig。然后将〜/ .kube / config文件的内容复制到服务连接以重试。
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
运行上述命令后,从本地计算机上的〜/ .kube / config复制配置。我使用kubeconfig选项成功添加了kubernetes连接
您也可以参考步骤here。