Multicast traffic to Kubernetes

10,510

Solution 1

In the end we picked method 1, as it is the documented way to achieve what we wanted, and I can report that it works fine.

Solution 2

A cleaner way to support multicast is to add an additional interface to your PODs through multus-cni. Then, you could associate this new multus interface to your host network interface that will receive multicast traffic on the host. Summarizing, you will have two interface on your POD i.e:

  1. net1 (default) for pod-to-pod communication and other unicast traffic.
  2. eth0 (multus) for multicast traffic. Then you will need to "join" it with a NIC in your host machine, either by using bridge or macvlan

See more details here: https://github.com/intel/multus-cni/blob/master/docs/quickstart.md

Solution 3

I played a bit with hostNetwork and I understand your reservations. I see that turning it on gives my pod the same IP as the hosting node. But then it cannot communicate with any of the nodes (maybe I did something wrong?).

Edit: I definitely missed out on something

hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet

I added the dnsPolicy

So I am trying now something alternative working with a CNI. Still researching that. It is new for me, so I will post an update once I can.

Solution 4

I heard that WeaveWorks supports multicast: https://www.weave.works/use-cases/multicast-networking/

github issue has few words on multicast support

Share:
10,510
Jjang
Author by

Jjang

Updated on June 05, 2022

Comments

  • Jjang
    Jjang almost 2 years

    I want my pods to receive multicast network traffic flowing from outside of my kubernetes cluster to specific ports in my nodes.

    I'm considering two solutions:

    1. Adding hostNetwork: true flag to their yaml file along with hostPort configuration in order to receive the traffic directly to the pod.
    2. Forwarding the traffic locally on the nodes from eth0 interface to docker0 interface using iptables command.

    Method 1 is an official feature in Kubernetes, but it feels like breaking a security wall that docker originally imposed, and might cause port collisions with host's processes, etc.

    Method 2 on the other hand transparently forwards the multicast network traffic to the pods.
    Despite the fact I can use an automation tool to spread this configuration (ansible/salt etc), anything configured 'out of the scope' of Kubernetes feels a little hacky to me.

    Would like to hear your pros and cons, comments, and maybe other solutions to the problem of multicasting to a kubernetes cluster.

  • DjSh
    DjSh over 4 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Rik Schaaf
    Rik Schaaf over 4 years
    Unfortunately I don't have much more info myself, as I was also researching this. Feel free to add to this in your own answer if you do find more info.
  • DjSh
    DjSh over 4 years
    Please read how to write good answers. If you think your answer does not have the quality that is expected, then avoid posting it. The other way is posting as a comment, but since you dont have enough reputation, you cannot do so.
  • Rik Schaaf
    Rik Schaaf over 4 years
    I would indeed have posted this as a comment if I could have
  • dbaltor
    dbaltor over 4 years
    Thanks @RikSchaaf
  • dbaltor
    dbaltor over 4 years
    Is your cluster running on on-prem? It seems this solutions would not work on Cloud given that they do not support multicast, e.g. Azure