I went through this link - Error when attempting to access azure aks with kubectl which talks about installing kubectl and kubelogin, but I am still not able to find a workaround.
This is basically what the problem is, after running these commands
az login
az account set --subscription
az aks get-credentials -n $AKS-cluster-name -g $resource-group-name
when I am trying to use kubectl,this is the error I get
error: The azure auth plugin has been removed
I have tried installing kubectl
and kubelogin
as mentioned in this forum earlier, but I still cannot run kubectl get pods
or any other commands.
PS C:\Windows\system32> kubectl get pods
error: The azure auth plugin has been removed.
Please use the https://github.com/Azure/kubelogin kubectl/client-go credential plugin instead.
See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins for further details
PS C:\Windows\system32>
Thanks to @silent for guiding in right direction.
As @silent mentioned, you have to use az aks get-credentials -n $AKS-cluster-name -g $resource-group-name --admin
to download the Kubernetes configuration file with administrative privileges.
--admin
flag, the configuration file will only include the credentials for a regular user, which limits the tasks that you can perform on the cluster.I have tried with az aks get-credentials -n $AKS-cluster-name -g $resource-group-name --admin
and az aks get-credentials -n $AKS-cluster-name -g $resource-group-name
in my environment. It worked in both cases as shown below:
Command 1:
Command 2:
Reference:
Refer to MSDOC for more info on '--admin' keyword as it returns the regular user creds of the AKS Cluster.