Kubernetes API pod 拒绝连接

Kubernetes API pod refuses connection

我目前正在尝试使用 CoreOS 和 Kubernetes 设置一个小型集群。要开始,我正在按照教程的 this tutorial. I have three CoreOS machines running on VirtualBox, using vagrant. I reached the second step 进行操作,但卡住了。

我似乎可以使用 systemctl start kubelet 启动 kubelet,但我似乎无法连接到 API 服务器。似乎它没有启动 API 服务器,而是先尝试连接到它。

当我输入 curl http://127.0.0.1:8080/version 时,我得到 curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused

Journalctl 只是告诉我 kubelet 正在尝试连接到 API 服务器并且由于无法访问 API 服务器,我无法使用 kubectl 查看发生了什么荚。我该如何解决这个问题?

编辑:

我手动执行了 docker 命令并得到了以下结果:

I1109 09:30:18.680796       1 plugins.go:69] No cloud provider specified.
I1109 09:30:18.826523       1 master.go:273] Node port range unspecified. Defaulting to 30000-32767.
E1109 09:30:18.847815       1 reflector.go:136] Failed to list *api.ResourceQuota: Get http://127.0.0.1:8080/api/v1/resourcequotas: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:18.848277       1 reflector.go:136] Failed to list *api.Secret: Get http://127.0.0.1:8080/api/v1/secrets?fieldSelector=type%3Dkubernetes.io%2Fservice-account-token: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:18.848581       1 reflector.go:136] Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:18.848766       1 reflector.go:136] Failed to list *api.LimitRange: Get http://127.0.0.1:8080/api/v1/limitranges: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:18.848943       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:18.849698       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
[restful] 2015/11/09 09:30:18 log.go:30: [restful/swagger] listing is available at https://172.17.8.101:443/swaggerapi/
[restful] 2015/11/09 09:30:18 log.go:30: [restful/swagger] https://172.17.8.101:443/swaggerui/ is mapped to folder /swagger-ui/
E1109 09:30:19.849251       1 reflector.go:136] Failed to list *api.Secret: Get http://127.0.0.1:8080/api/v1/secrets?fieldSelector=type%3Dkubernetes.io%2Fservice-account-token: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:19.850278       1 reflector.go:136] Failed to list *api.ResourceQuota: Get http://127.0.0.1:8080/api/v1/resourcequotas: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:19.852294       1 reflector.go:136] Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:19.852462       1 reflector.go:136] Failed to list *api.LimitRange: Get http://127.0.0.1:8080/api/v1/limitranges: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:19.852802       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:19.854201       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.852158       1 reflector.go:136] Failed to list *api.Secret: Get http://127.0.0.1:8080/api/v1/secrets?fieldSelector=type%3Dkubernetes.io%2Fservice-account-token: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.852217       1 reflector.go:136] Failed to list *api.ResourceQuota: Get http://127.0.0.1:8080/api/v1/resourcequotas: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.853732       1 reflector.go:136] Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.854456       1 reflector.go:136] Failed to list *api.LimitRange: Get http://127.0.0.1:8080/api/v1/limitranges: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.855127       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:20.855954       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused

... Repeated many times ...

E1109 09:30:35.882091       1 reflector.go:136] Failed to list *api.Namespace: Get http://127.0.0.1:8080/api/v1/namespaces: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:36.082552       1 reflector.go:136] Failed to list *api.Secret: Get http://127.0.0.1:8080/api/v1/secrets?fieldSelector=type%3Dkubernetes.io%2Fservice-account-token: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:36.282562       1 reflector.go:136] Failed to list *api.ResourceQuota: Get http://127.0.0.1:8080/api/v1/resourcequotas: dial tcp 127.0.0.1:8080: connection refused
E1109 09:30:36.482611       1 reflector.go:136] Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts: dial tcp 127.0.0.1:8080: connection refused
F1109 09:30:36.664838       1 controller.go:80] Unable to perform initial IP allocation check: unable to refresh the service IP block: 501: All the given peers are not reachable (failed to propose on members [172.17.8.101 172.17.8.102 172.17.8.103] twice [last error: Get 172.17.8.103/v2/keys/registry/ranges/serviceips?quorum=false&recursive=false&sorted=false: unsupported protocol scheme ""]) [0]

您将在下一步中设置 apiserver。它是服务于 127.0.0.1:8080 的东西。一旦 apiserver 启动,kubelet 应该停止抱怨。您提到的 curl 命令在那时也应该有效。

我暂时放弃了这个设置。我认为这与 ssl 设置中的错误配置有关。现在我只使用 this 指南,结合前面提到的教程,并从配置文件中删除所有与 ssl 相关的东西。这为我提供了一个工作设置。