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.kubeconfig
. I copied this file into default .kubeconfig
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
2
Answers
The error implies that the
kubelogin
executable could not be located. You need to installkubelogin
in 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.
Output:
Once you have the
aks
credentials, runningkubectl get pods
will prompt you for anAzure 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
--admin
flag in the end.Refer this doc by @Geert Baeke for more related information.
Check the kube config version and upgrade if required.
Try to run the following
az aks install-cli
Source: https://learn.microsoft.com/en-us/answers/questions/1106601/aks-access-issue