2015-11-02 116 views
4

我正在尝试使用CoreOS和Kubernetes设置一个小型群集。要开始,我正在关注this教程。我有三台运行在VirtualBox上的CoreOS机器,使用vagrant。我到达了本教程的second step,但卡住了。Kubernetes API pod拒绝连接

我似乎能够使用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来查看Pod上发生了什么。我应该如何解决这个问题?

编辑:

我手动执行的泊坞窗命令,并得到了以下回:

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] 

回答

0

我暂时放弃了这个设置。我认为它在ssl设置中有一些错误配置。现在我只是使用this指南,结合上述教程,并从配置文件中剥离了所有与ssl相关的东西。这给了我一个现在的工作设置。

0

你要设置的API服务器中的下一个步骤。它是服务于127.0.0.1:8080的东西。一旦apiserver启动,kubelet应该停止抱怨。你提到的curl命令也应该在这一点上工作。

+0

嗨,谢谢你的回答。我在教程的第3部分看到了“设置kube-apiserver Pod”部分。奇怪的是,他们要求你等到api服务器出现,第2部分。我没有办法在下个星期一之前测试它。我会让它知道它是否成功。 – palaga

+0

我似乎错过了一些东西,因为第3部分没有讨论设置API服务器。问题依然存在。 – palaga

+0

它对'wget https:// raw.githubusercontent.com/coreos/pods/master/kubernetes.yaml'和'sudo cp kubernetes.yaml/etc/kubernetes/manifests/ '说。 'kubernetes.yaml'包含运行kube-apiserver的指令,'cp'命令将文件放到一个目录中,kubelet将自动检测文件并读取并启动apiserver。在你完成这一步之后,等一会儿,然后'ps -ef'应该显示'kube-apiserver'正在运行。这将在端口127.0.0.1:8080服务,然后KUBELET将与之通话。 –