简体   繁体   English

到 Kubernetes 的多播流量

[英]Multicast traffic to Kubernetes

I want my pods to receive multicast network traffic flowing from outside of my kubernetes cluster to specific ports in my nodes.我希望我的 pod 接收从我的 kubernetes 集群外部流向我节点中特定端口的多播网络流量。

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.hostNetwork: true标志与hostPort配置一起添加到他们的yaml文件中,以便直接接收到 pod 的流量。
  2. Forwarding the traffic locally on the nodes from eth0 interface to docker0 interface using iptables command.使用iptables命令将节点上的本地流量从eth0接口转发到docker0接口。

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.方法1是Kubernetes的官方特性,但是感觉就像打破了docker最初强加的安全墙,可能会导致与主机进程的端口冲突等。

Method 2 on the other hand transparently forwards the multicast network traffic to the pods.另一方面,方法 2 将多播网络流量透明地转发到 pod。
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.尽管我可以使用自动化工具来传播这个配置(ansible/salt 等),但任何配置在 Kubernetes 的“范围之外”的东西对我来说都感觉有点麻烦。

Would like to hear your pros and cons, comments, and maybe other solutions to the problem of multicasting to a kubernetes cluster.想听听您的优点和缺点、评论,以及多播到 kubernetes 集群的问题的其他解决方案。

A cleaner way to support multicast is to add an additional interface to your PODs through multus-cni .支持多播的一种更multus-cni通过multus-cni向您的 POD 添加一个额外的接口。 Then, you could associate this new multus interface to your host network interface that will receive multicast traffic on the host.然后,您可以将这个新的multus接口关联到将在主机上接收多播流量的主机网络接口。 Summarizing, you will have two interface on your POD ie:总而言之,您的 POD 上将有两个界面,即:

  1. net1 (default) for pod-to-pod communication and other unicast traffic. net1 (默认)用于 pod-to-pod 通信和其他单播流量。
  2. eth0 (multus) for multicast traffic. eth0 (multus) 用于多播流量。 Then you will need to "join" it with a NIC in your host machine, either by using bridge or macvlan然后您需要使用bridgemacvlan将它与主机中的网卡“加入”

See more details here: https://github.com/intel/multus-cni/blob/master/docs/quickstart.md在此处查看更多详细信息: https : //github.com/intel/multus-cni/blob/master/docs/quickstart.md

I played a bit with hostNetwork and I understand your reservations.我和 hostNetwork 玩了一会儿,我理解你的保留意见。 I see that turning it on gives my pod the same IP as the hosting node.我看到打开它会为我的 pod 提供与托管节点相同的 IP。 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我添加了dnsPolicy

So I am trying now something alternative working with a CNI.所以我现在正在尝试使用 CNI 的替代方法。 Still researching that.还在研究那个。 It is new for me, so I will post an update once I can.这对我来说是新的,所以我会尽快发布更新。

最后我们选择了方法 1,因为它是实现我们想要的记录的方式,我可以报告它工作正常。

I heard that WeaveWorks supports multicast: https://www.weave.works/use-cases/multicast-networking/听说WeaveWorks支持组播: https ://www.weave.works/use-cases/multicast-networking/

github issue has few words on multicast support github 问题对多播支持几乎没有字数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM