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

Tomasz Sleboda 6 Reputation points
2021-07-20T10:46:12.587+00:00

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 
Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,457 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Chitrabalan M 5 Reputation points
    2023-08-08T07:22:11.6833333+00:00

    we can use sudo hwclock -s in the WSL to avoid this issue

    1 person found this answer helpful.
    0 comments No comments

  2. Desmond Sindatry 36 Reputation points
    2022-02-03T21:38:59.287+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.