Body: <p>I have 2 identical docker containers running on separate computers in which I want to run ROS2 nodes communicating with each other (via a VPN).</p>
  <p>When I run them as docker containers there is no problem getting them to communicate. However when I try to deploy the same image to one of the computers as a Kubernetes pod, suddenly only a fraction of the messages are getting through, and the apparent bandwidth drops massively, even though the computers are connected via gigabit Ethernet.</p>
  <p>What could be causing this issue? Or any suggestions on how to debug this issue?</p>
  
Comments: CC BY-SA 4.0
Comments: 2023-07-08T20:13:01.803Z
Comments: Share how are you running these applications; as deployment or statefulset or just raw pods? Do you set up any service etc. Show us partial YAMLs. Also share with us what kind of Kubernetes are you using / how do you set it up (kops, kubeadm, Rancher, EKS, AKS, GKE...?)
Comments: Kyslik
Comments: CC BY-SA 4.0
Comments: 2023-07-13T14:26:07.483Z
Comments: Its just pods, turns out just by brute force I noticed that its caused by not using hostnetworking. By adding `hostNetwork: true` to the yaml it seems to work now. I'm not sure of the actual problem though, I seem to have just worked around it.
Comments: clemfandango
Tags: <docker><kubernetes><networking><distributed-systems>
Title: Kubernetes networking somehow breaks ROS2 message passing
UserDisplayName: clemfandango
ThreadText: # Kubernetes networking somehow breaks ROS2 message passing
  
  (Asked by: username_0 on 2023-07-04)
  
  I have 2 identical docker containers running on separate computers in which I want to run ROS2 nodes communicating with each other (via a VPN).
  
  When I run them as docker containers there is no problem getting them to communicate. However when I try to deploy the same image to one of the computers as a Kubernetes pod, suddenly only a fraction of the messages are getting through, and the apparent bandwidth drops massively, even though the computers are connected via gigabit Ethernet.
  
  What could be causing this issue? Or any suggestions on how to debug this issue?
  
  **Tags:** docker, kubernetes, networking, distributed-systems
  
  > **Comments:**
  > **username_1**: Share how are you running these applications; as deployment or statefulset or just raw pods? Do you set up any service etc. Show us partial YAMLs. Also share with us what kind of Kubernetes are you using / how do you set it up (kops, kubeadm, Rancher, EKS, AKS, GKE...?)  
  > **username_0**: Its just pods, turns out just by brute force I noticed that its caused by not using hostnetworking. By adding `hostNetwork: true` to the yaml it seems to work now. I'm not sure of the actual problem though, I seem to have just worked around it.  
  
  ---
  
  ## 0 answers
  
  