error: You must be logged in to the server - the server has asked for the client to provide credentials - “kubectl logs” command gives error

后端 未结 4 1215
小蘑菇
小蘑菇 2021-02-15 02:11

We had setup kubernetes 1.10.1 on CoreOS with three nodes. Setup is successfull

NAME                STATUS    ROLES     AGE       VERSION
node1.example.com   Rea         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-02-15 02:27

    In my case, I experienced multiple errors while trying to run different kubectl commands like unauthorized, server has asked client to provide credentials, etc. After spending a few hours, I deduced that the sync to my cluster on cloud somehow gets messed up. So I run the following commands to refresh the configuration and it starts to work again:

    1. Unset users:

      kubectl config unset users.

    2. Remove cluster:

      kubectl config delete-cluster

    3. Remove context:

      kubectl config delete-context

    4. Default context:

      kubectl config use-context contexts

    5. Get fresh cluster config from cloud:

      ibmcloud cs cluster config --cluster

    Note: I am using ibmcloud for my cluster so last command could be different in your case

提交回复
热议问题