question

TomaszSleboda-6398 avatar image
1 Vote"
TomaszSleboda-6398 asked DesmondSindatry-9289 answered

AKS AAD enabled kubectl: error: You must be logged in to the server (Unauthorized)

I have AKS cluster (1.18.17) with aad enabled and since couple of days I get following error from kubectl

error: You must be logged in to the server (Unauthorized)

az login
az account set --subscription <subscription>
az aks get-credentials --resource-group <group name> --name <aks name>
kubectl get nodes

however, if I load credentials with admin parameter everything works fine.

az aks get-credentials --resource-group <group name> --name <aks name> --admin

my client kubectl version is 1.21

while troubleshooting this issue I've noticed such error in logs (LogAnalytics - AzureDiagnostics | where Category == "guard")

http: TLS handshake error from X.X.X.X:58022: remote error: tls: bad certificate

azure-kubernetes-service
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TomaszSleboda-6398 , Thank you for your question.

Can you please reset the AAD Application credentials as described here and check if this helps?


0 Votes 0 ·

unfortunately,

Operation failed with status: 'Bad Request'. Details: Operation 'resetAADProfile' is not allowed for managed AAD enabled cluster.

0 Votes 0 ·

@TomaszSleboda-6398 , Thank you for your response. We are checking this internally. We'll reach out to you as we have more information.

0 Votes 0 ·
Show more comments

1 Answer

DesmondSindatry-9289 avatar image
0 Votes"
DesmondSindatry-9289 answered

I am having the same issue. I spun up the cluster from server X and that server has access to k8s endpoint. Now I go to server Y and after doing the steps above I dont have access. I believe its a FW issue at our end.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.