Multicast traffic to Kubernetes

折月煮酒 提交于 2020-01-25 08:00:07

问题


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.


回答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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/48304357/multicast-traffic-to-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!