简体   繁体   English

向不同节点上的所有 kubernetes pod 多播 udp 数据包

[英]multicast udp packets to all kubernetes pods on different nodes

I'am searching on how to send multicast udp packet to pods in my kubernetes cluster我正在搜索如何将多播 udp 数据包发送到我的 kubernetes 集群中的 pod

after some investigation in this issue i realized that all my pods can see packet only if it running on the same node other pods that living on another node can't see the routed packet,在对此问题进行了一些调查后,我意识到我的所有 pod 只能看到数据包,前提是它运行在同一节点上,而生活在另一个节点上的其他 pod 无法看到路由的数据包,

i have test it on my gcp account , i haven't test it on any other k8s cloud providers i have implement it using java spring boot integration see my git repo我已经在我的gcp帐户上测试过它,我没有在任何其他 k8s 云提供商上测试过我已经使用 java spring boot 集成实现了它,请参阅我的git repo

i have implemented two modules我已经实现了两个模块

    <modules>
        <module>livefeed</module> #read packet on the network on 4444 port
        <module>livesender</module> # multicast 1 packet every 1 second
    </modules>

i have made my deployment kind DaemonSet to make sure kubernetes schedule every pod on different node我已经做了我的部署类DaemonSet以确保 kubernetes 在不同的节点上安排每个 pod

i am using spring integration to read routed packet as @Bean public IntegrationFlow processUniCastUdpMessage() { return IntegrationFlows .from(new MulticastReceivingChannelAdapter("224.0.0.1", 4444)) .handle(x -> log.info(new String(((byte[]) x.getPayload())))) .get(); }我正在使用 spring 集成将路由数据包读取为@Bean public IntegrationFlow processUniCastUdpMessage() { return IntegrationFlows .from(new MulticastReceivingChannelAdapter("224.0.0.1", 4444)) .handle(x -> log.info(new String(((byte[]) x.getPayload())))) .get(); } @Bean public IntegrationFlow processUniCastUdpMessage() { return IntegrationFlows .from(new MulticastReceivingChannelAdapter("224.0.0.1", 4444)) .handle(x -> log.info(new String(((byte[]) x.getPayload())))) .get(); }

I hope someone can help me if should i configure vpn on gcp or something else.如果我应该在 gcp 或其他东西上配置 vpn,我希望有人可以帮助我。

See this thread , you need to configure your kubernetes cluster to add the following config for multicasting to function correctly:请参阅此线程,您需要配置您的 kubernetes 集群以添加以下配置以使多播正常运行:

hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet

Hope this helps.希望这可以帮助。

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

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