Agent does not rejoin the Swarm agent cluster after overlay connectivity returns

オープン
#754 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, go, kubernetes

調査の方向性

Start with serf/cluster.go, especially the startup Join attempt cited in the issue, and check how the agent discovers peers after an initial failure. The issue points to Serf's reconnect behavior in v0.8.3 as relevant context. Reproduce the blocked-overlay startup, restore connectivity, and confirm the agent rejoins without a restart and the reported cluster membership and /info requests recover.

索引モデルが issue の本文から書いたものです。

説明

A Portainer Agent remains outside the agent cluster even though its container is running and /ping returns 204. Restarting only the affected agent restores membership and access through Portainer.

Reproduction and observations

  1. Start with a working multi-node Swarm and Portainer agents.

  2. On one test worker, temporarily block inbound and outbound VXLAN traffic.

    iptables -I INPUT 1 -p udp --dport 4789 -j DROP
    iptables -I OUTPUT 1 -p udp --dport 4789 -j DROP
    
  3. Stop its agent container and let Swarm create a replacement.

  4. Keep the network blocked until the new agent starts its API. In my test, DNS returned peer addresses and DROP counters increased, but the agent logged only its own join. About five minutes later, while still blocked, its API started. Identities below are placeholders:

    [INFO] serf: EventMemberJoin: worker-a-111111111111 192.0.2.10
    INF github.com/portainer/agent/http/server.go:96 > starting Agent API server | api_version=2.27.9 server_addr=0.0.0.0 server_port=9001 use_tls=true
    
  5. Remove the block:

    iptables -D INPUT -p udp --dport 4789 -j DROP
    iptables -D OUTPUT -p udp --dport 4789 -j DROP
    
  6. Check recovery. After the block was removed, both rules were absent, the same process was running, and /ping on 9001 returned 204 and TCP 7946 connected in both directions between the agent's network namespace and a manager. Yet no further joins appeared, and the agent logged:

    ERR github.com/portainer/agent/http/handler/docker/docker_operation.go:70 > unable to redirect request to a manager node: no manager node found | request=/info
    

    The cluster diagnostic reported only this agent as notInCluster. The membership gap was visible from both sides:

    • Other agents could not find the affected worker. Targeted Inspect (nodeName and X-PortainerAgent-Target) returned HTTP 500:

      {"message":"The agent was unable to contact any other agent","details":"Unable to find the targeted agent"}
      
    • The affected worker could not find a manager to handle /info. Opening the environment in the WebUI failed with Failed loading environment / Unable to connect to the Docker environment (this was the original symptom that prompted this issue):

      screenshot-2026-11-12-01-01-03

      Of 32 requests to /api/endpoints/7/docker/v1.41/info, 15 returned HTTP 500, while 17 succeeded:

      {"message":"The agent was unable to contact any other agent located on a manager node","details":"Unable to find an agent on any manager node"}
      

    Port 9001 is published in ingress mode; an ingress connection to the affected worker was present during the failures.

  7. Stop only the affected agent again. After Swarm replaced it, membership was restored and targeted Inspect of the replacement returned HTTP 200. All 32 of 32 subsequent /info requests returned HTTP 200. No Docker daemon or host restart was needed.

Expected: the agent rejoins after connectivity returns, without an operator restart.

Environment

  • Portainer Agent 2.27.9, deployed as a global Swarm service; all other agents run the same version.
  • Docker Engine 28.1.1, Linux.
  • Portainer Server 2.28.1.

P.S. I know Portainer requires matching Agent and Server versions, but agents discover each other without involving the Server. I have also seen the same symptom on another cluster with matching versions, but that cluster isn't available for reproduction tests.

Cause analysis

In 2.27.9, startup attempts Join once and continues on failure. Serf reconnects only to previously known failed members, so an isolated startup appears to leave the agent without a recovery path.

主要言語
Go
スター
596
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

portainer/agent のほかの issue

portainer/agent の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。