[Solved] Error from server (InternalError): an error on the server (““) has prevented the request from suc

Phenomenon

This error occurs when executing any k8s command

[root@master helm]# kubectl get pod
Error from server (InternalError): an error on the server ("") has prevented the request from succeeding

reason

To contact apiserver, you need to visit: https://master:6443

The current command is executed directly on the control plane, so it is necessary to ensure that there is no problem in the resolution of Master

# Since the http proxy was previously configured on the local machine
export http_proxy='http://10.0.0.1:8889'
export https_proxy='http://10.0.0.1:8889'

# and
[root@master helm]# hostname
master

Therefore, the resolution of Master is local and will be proxy to http://10.0.0.1:8889

Therefore, the apiserver cannot be accessed normally

Solution:

Method 1: cancel the agent

unset http_proxy
unset https_proxy

Method 2: do not proxy this machine

export no_proxy='master,localhost,127.0.0.1,localaddress,.localdomain.com'

Note: if it is not restored after modification, you can try to restart the kubelet service of the node.

Read More: