You must be logged in to the server (the server has asked for the client to provide credentials)

Yusuke 1 Reputation point
2021-11-01T15:31:18.157+00:00

I'm having a this error. How to solve it?
145348-image.png

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,884 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Pradeep Kommaraju 2,551 Reputation points
    2021-11-01T23:09:15.25+00:00

    Hi @Yusuke

    Thank you for reaching out to Microsoft Q and A Platform ,

    Regarding the error you have posted , Please try to first connect to the cluster by using following command :
    az aks get-credentials --resource-group rgname --name clustername

    You can get this data by clicking on the cluster connect ,
    So please try to execute the above command first and then try out your kubectl get services command

    145633-image.png

    Kindly request you to accept the answer if this helped in fixing your issue so that it would be useful for the community .

    Thanks & Regards ,
    Pradeep

    5 people found this answer helpful.

  2. Maruthi Jella 1 Reputation point
    2022-11-20T22:20:57.913+00:00

    didnt fix the issue for me. The error still says you need to be logged in to server (unauthorized)


  3. Anekal, Sripad 0 Reputation points
    2023-05-18T12:40:14.0766667+00:00

    User can get credential using --admin at the end of get-credentials command. this is the alternative.

    I am also facing the same issue after i enabled azure AD authentication with Kubernetes RBAC.

    0 comments No comments

  4. Chukwuduzie Blaise 90 Reputation points
    2023-09-23T08:50:41.46+00:00

    If you are trying to deploy a containerized application on Azure Kubernetes service then you are most likely facing this issue because you have not created your Azure Kubernetes service cluster properly. Go back and sign in to Azure cloud shell properly and create configuration values, this should work well.

    0 comments No comments