0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Tailscale を再起動すると k3s ノードが黙って孤立する(flannel VXLAN)― 確認・回避・検知

0
Posted at

対象

  • flannel の VXLAN バックエンド(k3s の組み込み flannel を含む)を使っている
  • --iface(k3s では flannel-iface)に tailscale0 などの VPN インターフェースを指定している(NetBird、WireGuard でも同じ)
  • flannel v0.28.10 以前

何が起きるか

tailscaled を再起動・更新すると、そのノードだけ他ノードの Pod に届かなくなります。ノードは Ready のままで、アラートも出ません。

k3s のログには次のように出て、一見復旧したように見えます。

Interface flannel.1 deleted
vxlan device missing, attempting to recreate...
external interface tailscale0 not found, retrying in 1s
VXLAN device flannel.1 recreated successfully

自分のノードが該当するか確認する

# 他ノード数と同じなら正常。0 なら孤立している
ip route | grep -c 'dev flannel.1'

# 孤立していると、どちらも空になる
ip neigh show dev flannel.1
bridge fdb show dev flannel.1

原因(要点)

  • VPN インターフェースが消えると、カーネルが flannel.1 と一緒に、そこを通るルート・ARP・FDB を消す
  • flannel はデバイス自体は作り直すが、ルート等を書くのは「他ノードのリースが変わったとき」だけ
  • 他ノードのリースは変わらないので、flannel を再起動するまで孤立したまま

修正は flannel-io/flannel#2618(作り直したデバイスに既知のリースを流し直す)で、v0.28.11 に入りました。2026-11-20 時点で v0.28.11 はプレリリースです。k3s は flannel の安定版を Updatecli で自動的に取り込む設定ですが、k3s の main の go.mod はまだ v0.28.10 です。

修正版が来るまでの回避

  • tailscaled の再起動・更新のあとに k3s / k3s-agent を再起動する(筆者の環境では 1 秒ほどでルートが戻りました)
  • 上の確認コマンドで flannel.1 のルート数が他ノード数と一致するか見る
  • 修正が入るまで Tailscale の自動更新を止めておく

検知(PromQL)

node_exporter の network_route コレクター(デフォルト無効、--collector.network_route で有効化)を使うと node_network_routes{device="flannel.1"} が取れます。ルートが全部消えると系列自体がなくなるので、欠損も拾います。

- alert: FlannelVxlanRoutesMissing
  expr: |
    (
      (
        max by (node) (node_network_routes{job="node-exporter", device="flannel.1"})
          < scalar(count(kube_node_info) - 1)
      )
      or
      (
        max by (node) (node_uname_info{job="node-exporter"})
          unless on (node) node_network_routes{job="node-exporter", device="flannel.1"}
      )
    )
    and on () (count(kube_node_info) > 1)
  for: 3m

前提:node-exporter の系列に node ラベルがあること(筆者の環境では relabel で付けています)、kube-state-metrics の kube_node_info があること。

詳しく知りたい方へ

再現手順、修正コードとテスト、upstream への出し方、調査での生成 AI の使い方は、筆者が Zenn に書いた記事にまとめています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?