ashraf revo
ashraf revo

Reputation: 817

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

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,

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

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

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(); }

I hope someone can help me if should i configure vpn on gcp or something else.

Upvotes: 1

Views: 4992

Answers (1)

Parth Mehta
Parth Mehta

Reputation: 1917

See this thread, you need to configure your kubernetes cluster to add the following config for multicasting to function correctly:

hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet

Hope this helps.

Upvotes: 1

Related Questions