TsuyoshiUshio / KubernetesTask

Kubernetes Task for Visual Studio Team Services
34 stars 14 forks source link

Unable to update Endpoint service in VSTS #35

Open KrishnaPrasadVV opened 6 years ago

KrishnaPrasadVV commented 6 years ago

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.

TsuyoshiUshio commented 6 years ago

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.

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.

KrishnaPrasadVV commented 6 years ago

@TsuyoshiUshio , Thanks for the response. we are still facing the issue. To re-produce the issue,

  1. Login to kubernetes site
  2. Expand user ID -- > My Account --> Download configuration
  3. open the saved Kubeconfig in Notepad ++
  4. Copy the content and paste to the VSTS Kubernetes endpoint service in the Kubeconfig field.

Removed the kubeconfig-

TsuyoshiUshio commented 6 years ago

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)

KrishnaPrasadVV commented 6 years ago

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 , I get the following message,

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.

TsuyoshiUshio commented 6 years ago

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.

KrishnaPrasadVV commented 6 years ago

@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.

TsuyoshiUshio commented 6 years ago

if you set the KUBECONFIG environment variables, you don't need C:\Kubeconfig\kube-config-k8s-alpha.txt.

KrishnaPrasadVV commented 6 years ago

@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:' for http/https

KrishnaPrasadVV commented 6 years ago

@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","errordescription":"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 ?

MitchDart commented 6 years ago

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.