簡體   English   中英

Docker1.12 Worker 無法加入集群(Swarm:待定)

[英]Docker1.12 Worker not able to join in cluster(Swarm: Pending)

管理器版本Docker version 1.12.0-rc5, build a3f2063

Worker 版本Docker version 1.12.0-rc5, build a3f2063

創建 Swarm 管理器:

docker swarm init --advertise-addr "172.25.30.2:4243"

    Swarm initialized: current node (3kmewyb10p8xj3ke5rpjyw4s8) is now a manager.

    To add a worker to this swarm, run the following command:
        docker swarm join \
        --token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq \
        172.25.30.2:4243

    To add a manager to this swarm, run the following command:
        docker swarm join \
        --token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-85cwe5pf779qw0knjn6wxdbim \
        172.25.30.2:4243

然后創建工人

docker swarm join --token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq 172.25.30.2:4243
    Error response from daemon: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use "docker info" command to see the current swarm status of your node.

我已經檢查了工作人員的日志

time="2016-08-01T00:22:47.449844174-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:22:47.449962215-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:22:47.450025342-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:22:47.450081950-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:22:47.450142443-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:22:47.450202836-07:00" level=error msg="cluster exited with error: rpc error: code = 1 desc = context canceled" 
time="2016-08-01T00:23:31.351868722-07:00" level=error msg="Handler for POST /v1.24/swarm/join returned error: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use \"docker info\" command to see the current swarm status of your node."

docker info中,我看到了“Swarm:Pending”

我也做了docker swarm update 。,仍然。 工人無法加入集群,那我該如何解決

更新-1

卸載並刪除配置文件,然后再次安裝 docker 1.12 版本Docker version 1.12.0, build 8eab29e

仍然面臨同樣的問題(無法加入和docker info中的“Swarm:Pending”),在/var/logs/upstat/docker.logs中有不同的錯誤

time="2016-08-01T11:22:08.629760770-07:00" level=error msg="Handler for POST /v1.24/swarm/join returned error: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use \"docker info\" command to see the current swarm status of your node."

謝謝。

問題是,我試圖加入錯誤的“端口”(如輸出中顯示的docker swarm init )。

1)在“docker swarm init”之前,docker 僅在端口“4243”上運行。 我已經檢查了netstat -tulp | grep docker netstat -tulp | grep docker 所以我用那個端口做廣告

root@veeru:~# netstat -tulpn | grep docker
tcp6       0      0 :::4243                 :::*                    LISTEN      8750/dockerd 

root@veeru:~# docker swarm init --advertise-addr "172.25.30.2:4243"
Swarm initialized: current node (exvwgj0pu4cd124ljnblt9xff) is now a manager.

To add a worker to this swarm, run the following command:
    docker swarm join \
    --token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-6zomhgu204m9alq51f632nzas \
    172.25.30.2:4243

To add a manager to this swarm, run the following command:
    docker swarm join \
    --token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-axhgqgo4jqw4hv38x578m44wh \
    172.25.30.2:4243

2) After docker swarm init , the docker is running with 4 port including the port 2377 ( netstat -tupln | grep docker ).

root@veeru:~# netstat -tulp | grep docker
tcp6       0      0 [::]:2377               [::]:*                  LISTEN      8750/dockerd    
tcp6       0      0 [::]:7946               [::]:*                  LISTEN      8750/dockerd    
tcp6       0      0 [::]:4243               [::]:*                  LISTEN      8750/dockerd    
udp6       0      0 [::]:7946               [::]:*                              8750/dockerd

在第 1 點,它告訴在 worker 中運行docker swarm join與端口4243 以前我確實是這樣跑的。 (它不會工作)

后來我做了docker swarm leave並加入了端口2377 現在我可以加入了

docker swarm join --token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-6zomhgu204m9alq51f632nzas 172.25.30.2:2377

對我來說,這也是一個防火牆問題。

  1. 我嘗試 ping 到管理器節點並 ping 回來

  2. 檢查端口是否使用 telnet 打開並且無法連接並確定這是端口問題。

如果您正在運行 Centos ,則可以使用防火牆輕松打開端口

檢查firewalld是否正在運行

sudo firewall-cmd --state

打開你想要的端口

sudo firewall-cmd --zone=public --add-port=2377/tcp

根據它嘗試連接的節點端口更改端口。

只需暴露管理器的 2377 端口即可。

這顯然意味着節點無法連接管理器,因此超時發生以符合相同只是執行telnet manager-ip 2377 (不要嘗試 ping,不會工作)。

如果即使在節點和管理器中都禁用了所有防火牆,您也面臨同樣的錯誤,請嘗試創建另一個暴露端口 2377 的管理器,如下所示:

docker-machine create --driver amazonec2 --amazonec2-open-port 2377 manager1

現在嘗試將節點加入到現在創建的新管理器中,但是如果你要使用 diff,那么你用來加入的端口應該是 2377,然后在上面的命令中公開該端口。 這樣做對我有用,因為我懷疑這是因為其他人使用了其他不同的服務器,但我對管理器和節點使用相同的服務器。

根據 dockers website Here他們聲明了要啟用的端口。 在 Swam Manager 和工作節點上運行以下命令

sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 2376/tcp
sudo ufw allow 2377/tcp
sudo ufw allow 7946/tcp
sudo ufw allow 7946/udp
sudo ufw allow 4789/udp
sudo ufw reload

我們只是允許訪問必要的端口。 運行這些命令后,所有 docker 命令現在應該可以工作了。

我遇到了類似的問題,而在我的情況下,端口由於防火牆規則而被阻止。

我遇到了同樣的問題。 我在 Azure 中運行 coreos vms。 我發現我所有的虛擬機都有相同的私有 ip 地址和不同的公共 ip 地址。 當 vm 屬於同一安全組時,通常會發生這種情況,但這次並非如此。 問題是我的帳戶已達到資源的最大數量,所以我刪除了 ip 地址、nsg、網絡等資源,然后重新配置了新的虛擬機,它們有不同的私有 ip,運行命令時一切都很好。 我的docker版本是1.12.6

假設你這樣做了; 如果您收到“連接超時”,則表示有防火牆阻止您連接。 要么在源主機上,要么在目標主機上(例如 iptables 規則)或介於兩者之間。 如果您在某些公共雲上運行,請確保訪問列表(例如 EC2 安全組)允許該端口上的主機之間的連接

我試圖通過 EC2 ubuntu 服務器 ami 映像連接 4 個節點(1 個主節點,3 個從節點),對我來說這是一個防火牆問題。 檢查您的安全組=>入站規則,對我來說這是自定義的,我將其更改為任何地方,它會起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM