I'm facing difficulties while trying to access one of my Kubernetes. I encounter an error message stating the following whenever I execute the kubectl
command:
error: failed to negotiate an API version
Could someone help me comprehend what could have gone wrong?
Despite my efforts to troubleshoot this problem, I've been unable to resolve the issue on my own.
When you are running kubectl command and you are getting an error: failed to negotiate an api version because this command needs to be authenticated.
Follow the two workarounds and have a try :
gcloud auth application-default login
Install the gcloud beta component (gcloud components install beta)
Run gcloud beta auth application-default login
After that, the kubectl version will work.
Refer to this doc for more information