在k8s的work节点 kubectl get nodes 报错,
kubectl version也是同样的报错
Error from server (InternalError): an error on the server ("") has prevented the request from succeeding
然后怎么办呢,各种搜索,需要将master节点的/root/.kube/config 文件拷贝到work节点的 /root/.kube目录即可。
[root@node01 .kube]# kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:44:59Z", GoVersion:"go1.19", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:38:15Z", GoVersion:"go1.19", Compiler:"gc", Platform:"linux/amd64"}
[root@node01 .kube]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master01 Ready control-plane 28h v1.25.0
node01 Ready
node02 Ready