Unable to connect to the server: getting credentials: exec: executable kubelogin not found
Apr 12
I created new config file for Kubernetes from Azure in Powershell by az aks get-credentials --resource-group <RGName> --name <ClusterName>. Got a message that Merged "cluster_name" as current context in C:\michu\.kube\config. I copied this file into default .kube\config location and now when I try to run any command e.g kubectl get pods I am receiving:
Unable to connect to the server: getting credentials: exec: executable kubelogin not found
It looks like you are trying to use a client-go credential plugin that is not installed.
To learn more about this feature, consult the documentation available at:
https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins
What is wrong here?
I just realized that when I type kubectl config get-contexts then I can see my cluster_name and I can even switch to this by kubectl config use-context cluster_name and message is correct: Switched to context cluster_name but then still all other commands ends with Unable to connect to the server: getting credentilas: exec: executable kubelogin not found
1 answer
Accepted answer · original discussion
Apr 12
The error implies that the kubelogin executable could not be located. You need to install kubelogin in the azure cli using
az aks install-cli, then it works as expected.
Refer github for installation process.
I tried the same requirement in my environment, and it worked for me as follows.
az aks get-credentials --resource-group caroline --name sampleaks1
kubectl get pods
Output:
Once you have the aks credentials, running kubectl get pods will prompt you for an Azure kubernetes service authentication with AAD, as shown.
Just give kubectl in the bash to verify whether it is installed successfully.
If still the issue persists,
Delete all the cache or any unused folders inside the ~/.kube/ and ran the aks credentials command by adding
--adminflag in the end.Refer this doc by @Geert Baeke for more related information.
Check the kube config version and upgrade if required.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.