gpt4 book ai didi

docker - 法兰绒和 docker 不启动

转载 作者:IT老高 更新时间:2023-10-28 21:25:44 25 4
gpt4 key购买 nike

我正在尝试使用 guide 在 2 个节点 centos 7.1 上建立一个 kubernetes 集群.但是,当我尝试像这样在 minion 上启动服务时:

for SERVICES in kube-proxy kubelet docker flanneld; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done

我收到以下错误:

-- Logs begin at Wed 2015-12-23 13:00:41 UTC, end at Wed 2015-12-23 16:03:54 UTC. --
Dec 23 16:03:47 sc-test2 systemd[1]: docker-storage-setup.service: main process exited, code=exited, status=1/FAILURE
Dec 23 16:03:47 sc-test2 systemd[1]: Failed to start Docker Storage Setup.
-- Subject: Unit docker-storage-setup.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker-storage-setup.service has failed.
--
-- The result is failed.
Dec 23 16:03:47 sc-test2 systemd[1]: Unit docker-storage-setup.service entered failed state.
Dec 23 16:03:48 sc-test2 flanneld[36477]: E1223 16:03:48.187350 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:49 sc-test2 flanneld[36477]: E1223 16:03:49.189860 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:50 sc-test2 flanneld[36477]: E1223 16:03:50.192894 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:51 sc-test2 flanneld[36477]: E1223 16:03:51.194940 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:52 sc-test2 flanneld[36477]: E1223 16:03:52.197222 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:53 sc-test2 flanneld[36477]: E1223 16:03:53.199248 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:54 sc-test2 flanneld[36477]: E1223 16:03:54.201160 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)

我确定我在主服务器上设置了 key :etcdctl mk/coreos.com/network/config '{"Network":"172.17.0.0/16"}'

到目前为止,安装似乎是使用 kubernetes 最难的部分:(

最佳答案

今天是圣诞节,但我花了一整天的时间试图让它发挥作用:) 这就是我所做的:

#1 法兰绒

如前所述,我会在 master 上设置 flannel etcd 键:

etcdctl mk/coreos.com/network/config '{"Network":"172.17.0.0/16"}'

但我在尝试在 minion 上启动 flannel 时遇到此错误:

获取网络配置失败:100:找不到 key (/atomic.io)

所以我编辑了 /etc/sysconfig/flanneld 文件来自:

# Flanneld configuration options  

# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://master:2379"

# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/coreos.com/network"

# Any additional options that you want to pass
#FLANNEL_OPTIONS=""

to:

# Flanneld configuration options

# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://master:2379"

# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/atomic.io/network"

# Any additional options that you want to pass
#FLANNEL_OPTIONS=""

即更改了 FLANNEL_ETCD 键。

在这个 systemctl start flanneld 工作之后。

#2 docker

我没有找到让 kubernetes 作为依赖项安装的版本工作的方法,所以我卸载了它并按照 Centos 的 docker 文档安装了 docker-engine 并手动为 systemctl 创建了一个 docker.service 文件。

cd/usr/lib/systemd/system

以及docker.service的内容:

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
Requires=flanneld.service
After=flanneld.service

[Service]
EnvironmentFile=/etc/sysconfig/flanneld
ExecStart=/usr/bin/docker daemon -H fd:// --bip=${FLANNEL_SUBNET}
Restart=on-failure
RestartSec=5


[Install]
WantedBy=multi-user.target

然后使用 systemctl 启动和启用守护进程并查询状态。

systemctl restart docker
systemctl enable docker
systemctl status docker

关于docker - 法兰绒和 docker 不启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34439659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com