8

このガイドを使用して、2 つのノード、centos 7.1 で kubernetes クラスターをセットアップしようとしています。ただし、次のようにミニオンでサービスを開始しようとすると:

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)

マスターにキーを設定したと確信しています: etcdctl mk /coreos.com/network/config '{"Network":"172.17.0.0/16"}'

インストールは、kubernetes を使用する上で最も難しいビットのようです :(

4

1 に答える 1

7

今日はクリスマスですが、これを機能させるために一日中費やしました:)これが私がしたことです:

#1 フランネル

前述のように、マスターにフランネルのetcdキーを次のように設定します。

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

しかし、ミニオンでフランネルを開始しようとすると、次のエラーが発生しました。

Failed to retrieve network config: 100: Key not found (/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 ドッカー

kubernetes によって依存関係としてインストールされたバージョンを機能させる方法が見つからなかったので、それをアンインストールし、Centos にインストールされた docker-engine の docker ドキュメントに従って、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
于 2015-12-25T17:49:53.677 に答える