错误:无法从服务器读取版本:获取http:// localhost:8080 / api:拨打tcp 127.0.0.1:8080:连接被拒绝 [英] Error: couldn't read version from server: Get http://localhost:8080/api: dial tcp 127.0.0.1:8080: connection refused

查看:1173
本文介绍了错误:无法从服务器读取版本:获取http:// localhost:8080 / api:拨打tcp 127.0.0.1:8080:连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此处的步骤在Linux上安装Kubernetes。 p>

一切正常,直到我退出终端并打开新的终端会话。



我遇到了权限被拒绝的错误,重新启动计算机后,出现以下错误

 > kubectl get pod 

错误:无法从服务器读取版本:获取http:// localhost:8080 / api:拨打tcp 127.0.0.1:8080:连接被拒绝

我刚刚开始使用Kubernetes,将不胜感激。

解决方案

我尝试通过执行以下操作来复制问题:


  1. 按照上面链接中的说明在新的ubuntu 15.04机器上安装Kubernetes。

  2. (与docker一起)停止了说明中给出的所有容器。

  3. 注销并再次登录

  4. 先启动etcd,然后是kubernetes master,然后是服务代理,以再次启动它们。

然后我立即运行获取节点得到与您相同的错误。

  [anovil @ ubuntu-anovil〜] $ kubectl获取节点
错误:无法从服务器读取版本:获取http:// localhost: 8080 / api:拨打tcp 127.0.0.1:8080:拒绝连接

[anovil @ ubuntu-anovil〜] $

然后我运行docker ps来检查它们是否都在运行,似乎不是这种情况。

  [anovil @ ubuntu-anovil〜] $ docker ps 
容器ID图像命令创建的状态端口名称
449b4751f0e4 gcr.io/google_containers/pause:0.8.0 / pause 3秒前向上2秒k8s_POD.e4cc795_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4c71c google_containers / hyperkube:v1.0.1 / hyperkube proxy --m 55秒前上55秒naughty_jennings
de9cf798bc2b gcr.io/google_containers/hyperkube:v1.0.1 / hyperkube kubelet-大约一分钟前关于一分钟desperate_pike
6d969a37428e gcr.io/google_containers/etcd:2.0.12 / usr / local / bin / etcd大约一分钟前大约一分钟jovial_jang
[anovil @ ubuntu-anovil〜] $

如您所见,控制器,apiserver和调度程序w失踪了。
如果这是您的问题,那么我等了一会儿,说1分钟,他们又都起来了。



因此,恢复只花了一些时间,之后

  [anovil @ ubuntu-anovil〜] $ kubectl获取节点
名称标签状态
127.0.0.1 kubernetes.io/hostname=127.0.0.1准备就绪
[anovil @ ubuntu-anovil〜] $ docker ps
容器ID图像命令创建的状态端口名称
0b8b7aae8143 gcr.io/google_containers/hyperkube:v1.0.1 / hyperkube scheduler 8秒前向上8秒k8s_scheduler.2744e742_k0.10.1-master _default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_6928bc83
0e25d641079b gcr.io/google_containers/hyperkube:v1.0.1 / hyperkube API服务器 八秒前最多8秒k8s_apiserver.cfb70250_k8s - 硕士 - 127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_1f35ee04
d5170a4bcd58 gcr.io/google_cont ainers / hyperkube:v1.0.1 / hyperkube controlle 8秒前上8秒k8s_controller-manager.1598ee5c_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_e9c8eaa4 $ b $ f。/ patains / pauses8.0 / ios4 gbbfb / pacones / pauses / pauses / USEA4 gbbfb / 449a 18秒前上升18秒k8s_POD.e4cc795_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_b169f4ad
8c37ad726b71 gcr.io/google_containers/hyperkubes av大约1分钟--vhyperk分钟:vn.0.1分钟b $ b de9cf798bc2b gcr.io/google_containers/hyperkube:v1.0.1 / hyperkube kubelet-大约一分钟前大约一分钟desperate_pike
6d969a37428e gcr.io/google_containers/etcd:2.0.12 / usr / local / bin / etcd大约一分钟前大约一分钟jovial_jang
[anovil @ ubuntu-anovil〜] $

启动etcd,master和proxy之后,您要做的第一件事是检查 docker ps 并查看它们是否全部正常。



此外,如果仍然有问题,可以尝试发布docker版本吗?主机详细信息(操作系统,版本等)?



谢谢,(我没有足够的声誉来对此请求发表评论)


I installed Kubernetes on linux using the steps here.

Everything worked fine until I exited the terminal and opened a new terminal session.

I got a permission denied error and after restarting my machine I get the following error

> kubectl get pod<br/>
error: couldn't read version from server: Get http://localhost:8080/api: dial tcp 127.0.0.1:8080: connection refused

I am just getting started with Kubernetes any help would be appreciated.

解决方案

I tried replicating the problem by doing this:

  1. Installed Kubernetes on a fresh ubuntu 15.04 machine from the instructions given in your link above.
  2. stopped (with docker) all the containers as given in the instructions.
  3. logged out and logged in again
  4. Started etcd and then kubernetes master and then the service proxy to get them up again.

Then immediately I ran get nodes to get the same error as yours.

[anovil@ubuntu-anovil ~]$ kubectl get nodes
error: couldn't read version from server: Get http://localhost:8080/api: dial tcp 127.0.0.1:8080: connection refused

[anovil@ubuntu-anovil ~]$ 

Then I ran docker ps to check if they are all running and seems not the case.

[anovil@ubuntu-anovil ~]$ docker ps
CONTAINER ID        IMAGE                                       COMMAND                  CREATED              STATUS              PORTS               NAMES
449b4751f0e4        gcr.io/google_containers/pause:0.8.0        "/pause"                 3 seconds ago        Up 2 seconds                            k8s_POD.e4cc795_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_b169f4ad
8c37ad726b71        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube proxy --m"   55 seconds ago       Up 55 seconds                           naughty_jennings
de9cf798bc2b        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube kubelet -"   About a minute ago   Up About a minute                       desperate_pike
6d969a37428e        gcr.io/google_containers/etcd:2.0.12        "/usr/local/bin/etcd "   About a minute ago   Up About a minute                       jovial_jang
[anovil@ubuntu-anovil ~]$

As you see, the controllers, apiserver and scheduler were missing. If this would have been your problem, then I just waited for a while, say 1 minute and they were all up again.

So, it just took some time to resume, after which

[anovil@ubuntu-anovil ~]$ kubectl get nodes
NAME        LABELS                             STATUS
127.0.0.1   kubernetes.io/hostname=127.0.0.1   Ready
[anovil@ubuntu-anovil ~]$ docker ps
CONTAINER ID        IMAGE                                       COMMAND                  CREATED              STATUS              PORTS               NAMES
0b8b7aae8143        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube scheduler"   8 seconds ago        Up 8 seconds                            k8s_scheduler.2744e742_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_6928bc83
0e25d641079b        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube apiserver"   8 seconds ago        Up 8 seconds                            k8s_apiserver.cfb70250_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_1f35ee04
d5170a4bcd58        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube controlle"   8 seconds ago        Up 8 seconds                            k8s_controller-manager.1598ee5c_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_e9c8eaa4
449b4751f0e4        gcr.io/google_containers/pause:0.8.0        "/pause"                 18 seconds ago       Up 18 seconds                           k8s_POD.e4cc795_k8s-master-127.0.0.1_default_f3ccbffbd75e3c5d2fb4ba69c8856c4a_b169f4ad
8c37ad726b71        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube proxy --m"   About a minute ago   Up About a minute                       naughty_jennings
de9cf798bc2b        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube kubelet -"   About a minute ago   Up About a minute                       desperate_pike
6d969a37428e        gcr.io/google_containers/etcd:2.0.12        "/usr/local/bin/etcd "   About a minute ago   Up About a minute                       jovial_jang
[anovil@ubuntu-anovil ~]$ 

The first thing you should do after starting the etcd, master and proxy is to check with docker ps and see if they all are up.

Also, if you still have problems then can you try posting your docker version, your host details (OS, version etc.)?

Thanks, (I do not have enough reputations to comment on this request)

这篇关于错误:无法从服务器读取版本:获取http:// localhost:8080 / api:拨打tcp 127.0.0.1:8080:连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆