<p>I have a (working) test program that sends and receives messages across UDP multicast. I've successfully deployed it to kubernetes cluster and demonstrated two pods communicating with one another. The only catch with this is that I need to add <code>hostNetwork: true</code> to the pod specs. As I understand it, this disables all the network virtualization that would otherwise be available. I've also tried</p>

<pre><code>        - containerPort: 12345
          hostPort: 12345
          protocol: UDP
</code></pre>

<p>but when I use that without <code>hostNetwork</code> communication fails.</p>

<p>Is there a way to get this working whilst still being able to use the normal network for everything else? (We're unlikely to want to switch network layer to something like Weave.)</p>

Julian Birch
<p>Using <code>hostNetwork: true</code> is good when you expect to get direct access from the nested pod to the Node network interface, however it brings some restrictions when you have application hosted on a few Nodes, because every time Kubernetes restarts the Pod, it can be spun on different Node as a result IP address for your application might be changed. Moreover, using <code>hostNetwork</code> makes some problem with port collisions when you are planning to scale your application within Kubernetes cluster and therefore not recommended to implement when you are bootstrapping Kubernetes cluster on Cloud environments. </p>

<p>If you wouldn't consider using overlay network for Pods communication as a significant part of <a href="https://kubernetes.io/docs/concepts/cluster-administration/networking/" rel="nofollow noreferrer">Cluster Networking</a> model, then you can lose some essential benefits like DNS resolving feature (<a href="https://github.com/coredns/coredns" rel="nofollow noreferrer">CoreDNS</a>, <a href="https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns/kube-dns" rel="nofollow noreferrer">Kube-DNS</a>). </p>

<p>I suppose you can try to use <code>NodePort</code> as a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">Service</a> object. Due to the fact that <code>NodePort</code> service proxies target application port on the corresponded Node it might be worth to check if it fits your requirement, however I don't know anything about your application deployment composition and network specification for a more advanced solution.</p>
