Skip to content

Kubernetes routing loop involving calico-node #7594

Closed as not planned
Closed as not planned

Description

@tasuren

What is the issue?

I tried to use a private network created by Tailscale to build a cluster of k8s (Kubernetes).
Then, Tailscale running on two servers running worker nodes joined to the cluster started to consume an unnatural amount of network (tx 600Mbps) and CPU (80%, total 100%).
Why is this?

Log of tailscaled:

$ journalctl -fu tailscaled
 3月 18 12:26:21 ... tailscaled[60693]: magicsock: disco: failed to send *disco.CallMeMaybe to 127.3.3.40:7: too many DERP packets queued; dropping
 3月 18 12:26:27 ... tailscaled[60693]: Accept: UDP{100.97.160.100:32927 > 100.112.81.21:4789} 638 ok
 3月 18 12:26:34 ... tailscaled[60693]: monitor: RTM_DELROUTE: src=, dst=fe80::/64, gw=, outif=59, table=254
 3月 18 12:26:34 ... tailscaled[60693]: monitor: RTM_DELROUTE: src=, dst=fe80::/128, gw=, outif=59, table=255
 3月 18 12:26:34 ... tailscaled[60693]: monitor: RTM_DELROUTE: src=, dst=fe80::ecee:eeff:feee:eeee/128, gw=, outif=59, table=255
 3月 18 12:26:34 ... tailscaled[60693]: monitor: RTM_DELROUTE: src=, dst=ff00::/8, gw=, outif=59, table=255
 3月 18 12:26:34 ... tailscaled[60693]: magicsock: endpoints changed: <CP Node IP>:53641 (stun), <CP Node IP>:41641 (stun4localport), 10.96.2.0:41641 (local), 10.244.55.193:41641 (local), 192.168.3.22:41641 (local), [<Some IPv6>]:41641 (local)
 3月 18 12:26:34 ... tailscaled[60693]: magicsock: endpoints changed: <CP Node IP>:35358 (stun), <CP Node IP>:41641 (stun4localport), 10.96.2.0:41641 (local), 10.244.55.193:41641 (local), 192.168.3.22:41641 (local), [<Some IPv6>]:41641 (local)
 3月 18 12:26:37 ... tailscaled[60693]: Accept: UDP{100.112.81.21:47872 > 100.97.160.100:4789} 638 ok out
 3月 18 12:26:37 ... tailscaled[60693]: magicsock: disco: failed to send *disco.CallMeMaybe to 127.3.3.40:7: too many DERP packets queued; dropping
 3月 18 12:26:47 ... tailscaled[60693]: Accept: UDP{100.112.81.21:33641 > 100.97.160.100:4789} 1278 ok out
 3月 18 12:26:57 ... tailscaled[60693]: Accept: UDP{100.97.160.100:32927 > 100.112.81.21:4789} 638 ok
 3月 18 12:26:58 ... tailscaled[60693]: magicsock: endpoints changed: <CP Node IP>:53641 (stun), <CP Node IP>:41641 (stun4localport), 10.96.2.0:41641 (local), 10.244.55.193:41641 (local), 192.168.3.22:41641 (local), [<Some IPv6>]:41641 (local)

Steps to reproduce

  1. Prepare k8s' controle-plane node and tailscale.
  2. Prepare k8s' worker node and join it to controle-plane node.

Are there any recent changes that introduced the issue?

After the second worker node is joined, the problem occurs until tailscale is brought down on both nodes or k8s is reset.

OS

Linux

OS version

Rocky Linux 9.1

Tailscale version

1.38.1

Other software

  • k8s (Kubernetes)
  • Calico for CNI of k8s (The same phenomenon occurred in Cilium.)

Bug report

BUG-199680f3bb80e6faa12a6cecd7fcff3fe73ca0d9a45008c8bba874b857e9840c-20230318035813Z-819d637d6cc505ad

Activity

  1. DentonGentry commented on Mar 18, 2023

    @DentonGentry
    Contributor

    This sounds like a routing loop.

    Are you using the Tailscale Kubernetes Operator, or a sidecar?

  2. tasuren commented on Mar 18, 2023

    @tasuren
    Author

    I heard that for first time. I'm going to see that.

    Also, I found that if calico-node is not running at least one worker node, the problem is solved. (Although the network is only available on the worker node that is running.)

  3. changed the title [-]Tailscale makes extensive use of networks.[/-] [+]Kubernetes routing loop[/+] on Mar 18, 2023
  4. changed the title [-]Kubernetes routing loop[/-] [+]Kubernetes routing loop involving calico-node[/+] on Mar 23, 2023
  5. tasuren commented on Mar 27, 2023

    @tasuren
    Author

    For now I have decided to use Tailscale in other parts of the system and WireGuard in the Kubernetes part.
    Then the problem was solved.
    Should I close this Issue?

  6. K8SLIKE commented on Mar 27, 2023

    @K8SLIKE

    Kubernetes,calico-node Keep restarting?

  7. tasuren commented on Mar 27, 2023

    @tasuren
    Author

    No restarting.

  8. added a commit that references this issue on Jul 22, 2023
    09e51cf
  9. ciffelia commented on Aug 27, 2023

    @ciffelia

    I have the same problem. My cluster uses Tailscale for communication between nodes (not pods) and Calico (VXLAN) for CNI.

    Recently I noticed that Tailscale's CPU usage was frequently spiking and communication between nodes was becoming unstable, so I checked the logs and found the following message.

    tailscaled[841]: magicsock: disco: node [XXX] d:xxx now using 10.244.x.y:41641
    

    Bug report: BUG-9933ac6858348ab1ecd0a30a4e1ea9563e5a2c5da197d8b758c4b1cc51b14436-20230827064054Z-f455a54d6b409056

    The CIDR of my cluster's pod network is 10.244.0.0/16. The fact that Tailscale is trying to communicate with other nodes through 10.244.x.y suggests that there is a loop between Tailnet and the pod network. In other words, packets sent from one node to another are first encapsulated by Tailscale, then by Calico, then by Tailscale, and so on.

    I think this problem can be solved if #1552 is implemented; I just need to exclude 10.244.0.0/16.

  10. ciffelia commented on Oct 14, 2023

    @ciffelia

    I built a software that limits network interfaces where tailscaled can send or receive packets. https://github.com/ciffelia/tsblock

  11. knyar commented on Nov 29, 2023

    @knyar
    Contributor

    At this point this does seem like a duplicate of #1552, so I am going to close it.

  12. morpig commented on Nov 13, 2024

    @morpig

    one year later, same exact issue (and not fixed.) thx for the repo @ciffelia!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    L2 FewP3 Can't get startedT5 Usabilitybugkubernetes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions