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
To contact apiserver
, you need to visit: https://master:6443
The current command is executed directly in the control plane, so it is necessary to ensure that there is no problem with the analysis of the master
# Because the machine was configured with http proxy before this
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 the master is the native machine and will be proxied to http://10.0.0.1:8889
So the apiserver
cannot be accessed normally
Method 1: Cancel the proxy
unset http_proxy
unset https_proxy
Method 2: Do not proxy the machine
export no_proxy='master,localhost,127.0.0.1,localaddress,.localdomain.com'
Note: If it is still not restored after modification, you can try to restart the kubelet
service of the node