Kubernetes安装与Vagrant& CoreOS背后的代理

时间:2016-08-19 17:40:00

标签: vagrant kubernetes coreos

我在代理服务器后面,按照此处列出的“使用Vagrant& CoreOS安装Kubernetes”步骤进行操作:https://coreos.com/kubernetes/docs/latest/kubernetes-on-vagrant.html

完成安装后,当我运行

$ kubectl get nodes

我收到了错误。

Unable to connect to the server: Service Unavailable

e1,c1和w1已经启动,我可以发出$ vagrant ssh。

当我检查w1时,我看到docker服务没有运行时出现下面列出的错误。

----------------------------------------------------------------------------
-- Unit docker.service has failed.
--
-- The result is dependency.
Aug 19 04:09:25 w1 systemd[1]: docker.service: Job docker.service/start failed with result 'dependency'.
Aug 19 04:09:25 w1 systemd[1]: flanneld.service: Unit entered failed state.
Aug 19 04:09:25 w1 systemd[1]: flanneld.service: Failed with result 'exit-code'.
Aug 19 04:09:30 w1 systemd[1]: flanneld.service: Service hold-off time over, scheduling restart.
Aug 19 04:09:30 w1 systemd[1]: Stopped Network fabric for containers.
-- Subject: Unit flanneld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit flanneld.service has finished shutting down.
Aug 19 04:09:30 w1 systemd[1]: Starting Network fabric for containers...
-- Subject: Unit flanneld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit flanneld.service has begun starting up.
Aug 19 04:09:30 w1 rkt[6888]: image: using image from file /usr/lib/rkt/stage1-images/stage1-fly.aci
Aug 19 04:09:31 w1 rkt[6888]: image: searching for app image quay.io/coreos/flannel
Aug 19 04:09:31 w1 rkt[6888]: run: discovery failed
Aug 19 04:09:31 w1 systemd[1]: flanneld.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 04:09:31 w1 systemd[1]: Failed to start Network fabric for containers.
-- Subject: Unit flanneld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit flanneld.service has failed.
--
-- The result is failed.
Aug 19 04:09:31 w1 systemd[1]: flanneld.service: Unit entered failed state.
Aug 19 04:09:31 w1 systemd[1]: flanneld.service: Failed with result 'exit-code'.

----------------------------------------------------------------------------

我猜这个问题是因为我在代理后面。在运行安装步骤之前,我发出命令

$export "HTTP_PROXY=http://http-proxy.xxxxxx.com:8080"
$export "HTTPS_PROXY=http://http-proxy.xxxxxx.com:8080"
$export "http_proxy=http://http-proxy.xxxxxx.com:8080"
$export "https_proxy=http://http-proxy.xxxxxx.com:8080"

您知道这对于代理后面的安装是否足够,或者我是否需要将代理设置添加到其他地方。

提前谢谢你, turgos

1 个答案:

答案 0 :(得分:1)

您导出的变量仅在您当前的shell会话中有效,它们不适用于您的法兰绒系统单元。

在systemd单元目录中创建以下drop-in,然后用systemctl daemon-reload重新加载守护进程,它应该修复你的法兰绒问题:

/etc/systemd/system/flannel.service.d/proxy.conf

[Service]
Environment="HTTP_PROXY=http://http-proxy.xxx:8080"
Environment="...

CoreOS文档中提供了类似的示例:Customizing Docker