multicast udp packets to all kubernetes pods on different nodes

1/13/2020

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.

-- ashraf revo
google-cloud-platform
google-kubernetes-engine
kubernetes
spring-boot
spring-integration

1 Answer

1/13/2020

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.

-- Parth Mehta
Source: StackOverflow