如何解决 'Unable to connect to the server: EOF' Kubernetes 的问题 - Kubectl
How to fix issue of 'Unable to connect to the server: EOF' Kubernetes - Kubectl
当我尝试任何 kubectl 命令时,它总是 returns:
Unable to connect to the server: EOF
我遵循了这些教程:
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
但是他们并没有帮助我。根据第一个link,默认情况下,kubectl配置位于
~/.kube/config
但在那条路上我一无所有。我不知道这是否会导致问题。
另一件事是当我尝试检查 kubectl 配置时:
M:.kube candres$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Unable to connect to the server: EOF
M:.kube candres$ kubectl cluster-info dump
Unable to connect to the server: EOF
我安装的版本是:
Kubernetes - kubectl
M:.kube candres$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"X", GitTreeState:"clean", BuildDate:"2018-02-09T21:51:06Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"darwin/amd64"}
Unable to connect to the server: EOF
迷你库
M:.kube candres$ minikube version
minikube version: v0.25.0
Docker:
M:.kube candres$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: X
Built: Wed Dec 27 20:03:51 2017
OS/Arch: darwin/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: X
Built: Wed Dec 27 20:12:29 2017
OS/Arch: linux/amd64
Experimental: true
有谁知道如何解决这个问题?
Minikube启动后,kubectl自动配置
minikube start
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:8443.
Kubectl is now configured to use the cluster.
您可以使用以下命令验证集群和上下文。
kubectl config view
我也有这个问题。请务必检查由 minikube
生成的配置文件。很可能可以找到此文件 ~/.kube/config
。确保您在当前使用的上下文中引用了正确的集群名称。您可以通过以下方式查看当前使用的上下文:kubectl get current-context
。重要的是您了解为什么会收到此错误,正如@Suresh Vishnoi 所说,kubectl
不知道 k8s
api-server.
只需将 Kubectl 版本更新到最新版本即可解决我的问题。
如果您收到这样的消息:
You appear to be using a proxy, but your NO_PROXY environment does not
include the minikube IP (www.xxx.yyy.zzz).
然后将环境变量 NO_PROXY 设置为 运行 kubectl 之前给出的地址。这可能在某处可配置,但这是一个简短的快速解决方案。
reset kubeadm via force
reset kubeadm -f
然后
再次复制配置文件
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
最后
kubectl init
这里是我的解决方案的步骤
- 安装 minikube:
brew install minikube
- 启动 minikube
minikube start
- 再次检查并 ✅
kubectl version --short
Client Version: v1.16.6-beta.0
Server Version: v1.22.2
我正在使用 wsl。所以它可以帮助我同步时间
windows 和 linux 控制台。
sudo hwclock --hctosys
当我尝试任何 kubectl 命令时,它总是 returns:
Unable to connect to the server: EOF
我遵循了这些教程:
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
但是他们并没有帮助我。根据第一个link,默认情况下,kubectl配置位于
~/.kube/config
但在那条路上我一无所有。我不知道这是否会导致问题。
另一件事是当我尝试检查 kubectl 配置时:
M:.kube candres$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Unable to connect to the server: EOF
M:.kube candres$ kubectl cluster-info dump
Unable to connect to the server: EOF
我安装的版本是:
Kubernetes - kubectl
M:.kube candres$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"X", GitTreeState:"clean", BuildDate:"2018-02-09T21:51:06Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"darwin/amd64"}
Unable to connect to the server: EOF
迷你库
M:.kube candres$ minikube version
minikube version: v0.25.0
Docker:
M:.kube candres$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: X
Built: Wed Dec 27 20:03:51 2017
OS/Arch: darwin/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: X
Built: Wed Dec 27 20:12:29 2017
OS/Arch: linux/amd64
Experimental: true
有谁知道如何解决这个问题?
Minikube启动后,kubectl自动配置
minikube start
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:8443.
Kubectl is now configured to use the cluster.
您可以使用以下命令验证集群和上下文。
kubectl config view
我也有这个问题。请务必检查由 minikube
生成的配置文件。很可能可以找到此文件 ~/.kube/config
。确保您在当前使用的上下文中引用了正确的集群名称。您可以通过以下方式查看当前使用的上下文:kubectl get current-context
。重要的是您了解为什么会收到此错误,正如@Suresh Vishnoi 所说,kubectl
不知道 k8s
api-server.
只需将 Kubectl 版本更新到最新版本即可解决我的问题。
如果您收到这样的消息:
You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (www.xxx.yyy.zzz).
然后将环境变量 NO_PROXY 设置为 运行 kubectl 之前给出的地址。这可能在某处可配置,但这是一个简短的快速解决方案。
reset kubeadm via force
reset kubeadm -f
然后 再次复制配置文件
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
最后
kubectl init
这里是我的解决方案的步骤
- 安装 minikube:
brew install minikube
- 启动 minikube
minikube start
- 再次检查并 ✅
kubectl version --short
Client Version: v1.16.6-beta.0
Server Version: v1.22.2
我正在使用 wsl。所以它可以帮助我同步时间 windows 和 linux 控制台。
sudo hwclock --hctosys