Kubectl error: "You must be registered on the server (the server asked the client to provide credentials)"

I run the following command and get an error message:

$ kubectl get nodes error: You must be logged in to the server (the server has asked for the client to provide credentials) 

What's happening?

+5
source share
4 answers

You need to run:

 $ gcloud container clusters get-credentials [cluster-name] 

Docs are here .

+5
source

$ gcloud config set compute / zone [zone]

$ gcloud container clusters get-credentials [clustername]

+1
source

Re-setting the calculation / zone seems to do the trick. Using this command

 gcloud container clusters list 

I got

 NAME ZONE MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS k0 europe-west1-d 1.6.4 35.187.164.84 n1-standard-1 1.6.4 3 RUNNING 

Thus, the zone seemed to be configured, but only after repeated execution

 gcloud config set compute/zone europe-west1-d 

started working again.

Thus, the real question arises: why does the configuration of the computing zone suddenly cease to be valid?

0
source

I got a similar problem in Minikube environment. I restarted the mini cube and it worked as expected. Therefore, if a problem occurs in the Minikube environment, restart it.

0
source

Source: https://habr.com/ru/post/1266108/


All Articles