KubernetesTask
KubernetesTask copied to clipboard
Unable to update Endpoint service in VSTS
Downloaded the Kubeconfig and when trying to update the KubeConfig contents to the VSTS Endpoint service getting the below error, "The Kubconfig does not contain user field. Please check the kubeconfig. " ( we have verified that the user field exist)
Kindly help to resolve this. we were able to use the same VSTS-Kubernetes a month back.
Hi @KrishnaPrasadVV
I try to reproduce, however, I can't do it. I'm not sure, however, I can guess it might the mismatch of the version of the cluster/kubectl which you download by the download task/kubeconfig. Workaround might be like this.
- kubectl version in your local machine and check the current server/client version
- specify the same version as the server on the download task. (by default it is 1.5.2)
- See the log of your release pipeline which is fail, you can see which kubectl command has been executed, do the same thing on your local machine with fitting your local pc's environment.
I update my endpoint by my new kubeconfig which is version 1.8.1 it works. If the workaround doesn't work, please let me know your configuration of your deployment pipeline.
@TsuyoshiUshio , Thanks for the response. we are still facing the issue. To re-produce the issue,
- Login to kubernetes site
- Expand user ID -- > My Account --> Download configuration
- open the saved Kubeconfig in Notepad ++
- Copy the content and paste to the VSTS Kubernetes endpoint service in the Kubeconfig field.
Removed the kubeconfig-
Hi @KrishnaPrasadVV Which do you use ACS or AKS? or the others?
The point is, before go to the VSTS, download the kubectl by yourself. then, put the kubeconfg on the default folder like ~/.kube/config or set environment variables KUBECONFIG to the binary. then execute kubectl get nodes and make sure if it works. My kubeconfig is different format with yours. If you use AKS, az aks install-cli command and az aks get-credentials comamnd. Please refer https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough . In case of ACS, you can ssh the master node, then get the ~/.ssh/config file via scp. Then put it on ~/.ssh/config on your local machine. also you can try az aks install-cli command to download kubectl binary on your local machine.
If it works locally, the config file must work on the VSTS task environment. (or this task or VSTS has a bug)
hi @TsuyoshiUshio ,
I have downloaded Kubeconfig from kubernetes and placed it in a folder ( c:\configfiles\ - we are using the windows machine) and when I execute the kubectl get nodes
C:\Users\k313203\kubectl_v1.9.0>kubectl.exe get node C:\Kuberconfig\kube-config-k8s-alpha.txt the server doesn't have a resource type "node"
Note : everything ( download kubeconfig from K8s server and updating that in the VSTS endpoint and deploying from VSTS to K8s)was working fine till 09-March-2018.
If the C:\Kuberconfig\kube-config-k8s-alpha.txt is config file, you need to specify the file path into the environemnt variables named KUBECONFIG then you can execute kubectl.exe get nodes and see what happens.
@TsuyoshiUshio , set the environment variable, now getting the below message, C:\Users\k313203\Downloads\kubectl_v1.9.0>kubectl.exe get node C:\Kuberconfig\kube-config-k8s-alpha.txt Unable to connect to the server: Get https://k8s-alpha.dev.dev-cglcloud.com/identity/.well-known/openid-configuration: dial tcp: lookup k8s-alpha.dev.dev-cglcloud.com: no such host
when I try to access k8s-alpha.dev.dev-cglcloud.com through URL am able to after selecting the "login with GitHub" authentication.
if you set the KUBECONFIG environment variables, you don't need C:\Kubeconfig\kube-config-k8s-alpha.txt.
@TsuyoshiUshio , unfortunately its the same error am getting, C:\Users\k313203\Downloads\kubectl_v1.9.0>kubectl.exe get node Unable to connect to the server: Get https://k8s-alpha.dev.dev-cglcloud.com/identity/.well-known/openid-configuration: dial tcp: lookup k8s-alpha.dev.dev-cglcloud.com: no such host
C:\Users\k313203\Downloads\kubectl_v1.9.0>
I have already set the proxy settings, 'http://a123456:password@address:
@TsuyoshiUshio , Now I set the proxy and get the below error, Unable to connect to the server: failed to refresh token: oauth2: cannot fetch token: 400 Bad Request Response: {"error":"invalid_request","error_description":"Refresh token is invalid or has already been claimed by anothe r client."}
Even though I downloaded and place the latest kubconfig file..
Is there any restriction for the number of time we can download the Kubeconfig ?
I am getting the same issue when I tried to update the kubectl config. I am using GKE cluster. When I paste my ~/.kube/config into the vsts service and click verify connection I get the error: "The Kubconfig does not contain user field. Please check the kubeconfig. " kubectl get nodes works just fine on my local machine. I can also confirm that this used to work.